bcicen/ctop · error

cannot restart container: %v

Error message

cannot restart container: %v

What it means

Wraps the error from the Docker Remote API's RestartContainer call (3-second stop timeout) in Docker.Restart. It fires when the daemon cannot stop-then-start the container — the container does not exist, is stuck stopping, or fails to start again (port conflict, image issue).

Source

Thrown at connector/manager/docker.go:147

func (dc *Docker) Restart() error {
	if err := dc.client.RestartContainer(dc.id, 3); err != nil {
		return fmt.Errorf("cannot restart container: %v", err)
	}
	return nil
}

View on GitHub (pinned to 59f00dd6aa)

Solutions

  1. Verify the container exists and is not wedged with docker inspect
  2. Increase the stop timeout if the container does not terminate within 3 seconds
  3. Retry the restart after transient daemon/connection errors
  4. Check daemon logs for the underlying start failure if the container fails to come back
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at connector/manager/docker.go:147 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bcicen/ctop@59f00dd6aa (2026-09-02). Data as JSON: /api/errors/08a90894ae29a70c. Report an issue: GitHub.