Docker

What is going on inside a Docker container?

What is going on inside a Docker container

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“.

Prerequisites

Let us first start an “nginx container” which is named as “nginx-test” as shown in the picture below.

Start an nginx container
Start an nginx container
$ 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 command for processes running inside a container
“docker container top” command for processes running inside a 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 command for live update
“docker container stats” command for live update
$ docker container stats nginx-test

docker container inspect <container-name/container-ID>

Docker container inspect command for container metadata
“docker container inspect” command for container metadata
$ docker container inspect nginx-test

Comment here