We often want to see what is going under the hood of the particular thing, and docker containers are no exception. Today we are interested in knowing about processes on things going on “inside a docker container“.
Let us first start an “nginx container” which is named as “nginx-test” as shown in the picture below.
$ docker container run -d -p 80:80 --name nginx-test nginx
docker container top <container-name/container-ID>
This command is used to view the running processes inside a particular container, from the picture below you can see that there are two processes running inside the “nginx-test” container.
$ docker container top nginx-test
docker container stats <container-name/container-ID>
This command is used to view the real time updates of a container, like “CPU usage“, “Memory usage” and other system aspects, as shown below.
$ docker container stats nginx-test
docker container inspect <container-name/container-ID>
$ docker container inspect nginx-test