A teammate just deployed myapp:latest to a server and messaged you that the container won't stay up. docker run prints a container id and the prompt returns — but when you come back a second later the container is already gone. The app's startup doesn't panic; it exits cleanly. Something it needs isn't there.
Your job: find what the app is missing, and restart the container so it reaches running and stays running.
Two containers on the host:
api-server — myapp:latest, exited with code 1 two minutes ago. No env vars set on it.db-postgres — healthy postgres:15-alpine, listening on 5432. Already has a database named app with user/password postgres/postgres.$ docker ps -a
CONTAINER ID IMAGE STATUS NAMES
f1e2d3c4b5a6 myapp:latest Exited (1) 2 minutes ago api-server
a6b5c4d3e2f1 postgres:15-alpine Up 1 hour db-postgres
$ docker logs api-server
Starting myapp...
Error: DATABASE_URL environment variable is not set.
The log tells you what is missing — now you need to restart the container with that piece of configuration set correctly.
You've solved it when:
DATABASE_URL is not set on api-server (from logs or inspect).api-server with DATABASE_URL pointing at the running db-postgres container.api-server reaches status=running and does not exit again.docker CLI only.-e? What's the docker run flag designed for larger config sets?docker inspect api-server --format '{{range .Config.Env}}{{println .}}{{end}}' tell you, and how does that compare to what you passed on the command line?