ProjectStack
docker

Error response from daemon: Container X is not running

You tried to run docker exec to execute a command in a container, but the container has already stopped. docker exec only works on running containers — you can't exec into a stopped or crashed container.

Common causes

  • The container exited on its own — check docker ps -a and docker logs to find out why
  • You stopped the container before trying to exec into it
  • A crash or OOM kill stopped the container between when you started it and when you tried to exec
  • You're referencing the correct container name but the container isn't the one you expect

How to fix it

  1. Check if the container is running: docker ps — it will only appear here if it's up
  2. See all containers including stopped ones: docker ps -a to check the status
  3. Start the stopped container: docker start CONTAINER_NAME
  4. To debug a crashed container, check logs: docker logs CONTAINER_NAME, then fix the crash before re-running

Example

$ docker exec -it myapp /bin/sh Error response from daemon: Container myapp is not running

Trying to exec into a container that has already exited

Browse more errors

The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.