bcicen/ctop · error

cannot stop container

Error message

cannot stop container: %v

What it means

Wraps the error from the Docker Remote API's StopContainer call (3-second grace period) in Docker.Stop. It fires when the daemon cannot stop the container — the container is already stopped or does not exist, or the daemon is unreachable.

Solutions

  1. Ignore 'container already stopped' errors as idempotent success
  2. Confirm the container ID with docker inspect before stopping
  3. Retry once after a short delay to cover transient daemon/connection failures
  4. Check Docker daemon health and socket permissions if errors persist
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at connector/manager/docker.go:119 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/4a670367209501c7. Report an issue: GitHub.

Appendix: source

Thrown at connector/manager/docker.go:119

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

View on GitHub (pinned to 59f00dd6aa)