The debugging trio
When something is wrong with a running container, three commands answer 90% of your questions.
docker logs — the first stop
Whatever the main process writes to stdout/stderr is captured. Always check logs first; most issues are visible there.
docker exec — get inside
docker exec runs a new process inside an already-running container. Different from docker run, which creates a fresh container. Use exec for poking around: ls, ps, cat /etc/..., or an interactive shell.
docker inspect — the metadata firehose
Returns a giant JSON document with everything Docker knows about the container: state, network, mounts, env vars, restart count, exit code. Use Go templates with --format to extract specific fields.