ProjectStack
docker

Container exited with code 1

The container's main process exited with a non-zero status code of 1, which indicates a general application error. Unlike codes 127 or 137, code 1 usually means the application itself started but then encountered an error and shut down rather than a system-level kill.

Common causes

  • The application crashed on startup — check logs with docker logs CONTAINER_ID
  • A missing environment variable, config file, or database connection the app requires
  • A startup script or entrypoint script encountered an error and exited
  • The application depends on another service that isn't ready yet (race condition in Compose)

How to fix it

  1. Read the container logs immediately: docker logs CONTAINER_ID (add --tail 100 for the last 100 lines)
  2. Run the container interactively to debug: docker run -it --entrypoint /bin/sh myimage
  3. Check required environment variables are set: docker run -e DB_URL=... myimage
  4. Use healthchecks and depends_on with condition in Compose to wait for dependencies

Example

$ docker run myapp $ docker ps -a CONTAINER ID STATUS abc123def456 Exited (1) 3 seconds ago

Container started but immediately exited — docker logs will show the actual error

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.