Debugging docker is not that much different from debugging normal applications. Same rules apply, we just need to know how to access stats and logs.

What if things go wrong? Restarting and rebuilding a container takes a lot of time, and if we don't know what is happening, its not an efficient way.

For this to work effectively, it is important that each container has a single purpose. There shouldn't be multiple ones running at once.

When the container is running

Check running containers

docker ps: Lists all running containers. If you want all (also stopped ones), add the option -a

docker inspect <container id>: View container details. This is useful to double check container configurations.

docker logs <container id>: check the logs of the container.

There are ways to attach a terminal onto a running container to be able to execute commands inside of it. However I don't see a reason you would do this so I am not adding it.

docker stats <container id>: see memory/cpu and other usage statistics.

docker top <container id>: See the running processes for this container.
Pasted image 20240812124242.png

Notice how this one container has spawned twice? It exists twice because it is running in multithreading I think.

It is also possible to pause a container, change some things and unpause. However I saw no reason to do so. Therefore I didn't add it.