Developer workflow, topic 35 of 41
Debugging containers
docker exec -it <container> sh opens a shell in a running container, and docker logs and docker inspect show what it printed and how it was started. A container that exits at once can be started with its entrypoint replaced, --entrypoint sh, to look around.
A slim or distroless image has no shell. docker debug attaches a toolbox to it without changing the image. To step through code, publish the debugger's port and attach your editor to it.
On Opsfolk
Nothing of ours for this topic yet: an article is on its way.
Elsewhere
- docker container execOfficial
- docker debugOfficial