is not running 🐳 Docker

Error response from daemon: Container X is not running

You tried to exec into or interact with a container that has stopped.

Seen on: Docker

Meaning

docker exec only works on running containers. The container probably crashed or exited right after start — check its logs and exit code, then start it again or run a new one interactively.

Common causes

  • Container exited (crash or finished CMD)
  • Container stopped manually or by restart policy
  • Container paused/restarting

⚡ Quick fix

  1. docker logs <container> to see why it stopped
  2. docker start <container> then exec
  3. Debug with docker run -it --entrypoint sh image

Detailed fix by platform

Docker

  1. bash
    docker logs --tail 50 web
    docker start web && docker exec -it web sh

How to diagnose

  1. State — docker inspect -f '{{.State.Status}} {{.State.ExitCode}}' web
  2. Logs — Why did it stop?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.