Back to error codes
ERROR Exit 1
Docker Container Exit Code 1
Docker Error
The container's main process exited with a general error.
Root Cause
The application inside the container crashed, threw an unhandled exception, or the entrypoint script failed.
How to Fix
Check container logs: docker logs <container-id>. Fix the application error. Ensure the entrypoint script exits with 0 on success.
Quick Summary
Exit code 1 means the container's main process failed with a general error. Check logs with docker logs <container-id> to find the specific error.
Key Takeaways
Key Takeaways
- Exit code 1 = general application error
- Check logs: docker logs <container-id> or docker logs --tail 100 <container-id>
- The entrypoint script must exit with 0 on success
- Use docker run --rm -it <image> /bin/sh to debug interactively
Use Cases
When to use it
- Application threw an unhandled exception
- Entrypoint script failed
- Missing environment variable caused a crash
Watch out
Common Mistakes
- Not checking logs, always check docker logs before debugging further
- Not setting a proper entrypoint, the container exits immediately if the main process is not long-running
FAQ
Exit 1 Docker Container Exit Code 1, Frequently Asked
How do I debug a container that exits immediately?
Override the entrypoint: docker run --rm -it --entrypoint /bin/sh <image> to get a shell inside the container.
Still having issues?
Check your network logs or use our developer tools to inspect headers, decode tokens, or validate your requests.