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
- Check if the container is running: docker ps — it will only appear here if it's up
- See all containers including stopped ones: docker ps -a to check the status
- Start the stopped container: docker start CONTAINER_NAME
- 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 runningTrying 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.
