In the previous page, you have understood basic management of a docker container and what you need to run, pause, stop a container. Now, we will discuss container logs and process management in Docker. Docker provides a few commands to view container information without using attach or exec commands. Will be also looking into how to achieve resource limitation.

View Docker Container logs

Docker provides docker logs command to fetch logs of a container.



  • To view logs in real time, -f (--follow) continues streaming the new output that container provides.
  • The command docker logs --details adds extra attributes, such as environment variables and labels, provided to --log-opt when creating the container.
  • The --since the option shows only the container logs generated after a given date.
  • The docker logs --timestamps command will add an RFC3339Nano timestamp , for example 2019-06-16T06:17:46.000000000Z, to each log entry. To ensure that the timestamps are aligned the nano-second part of the timestamp will be padded with zero when necessary.

I encourage you to try out the above commands and let me know your challenges in the comment below.

Docker container process information

Docker provides docker top and docker stats to get information about the running processes inside a Docker container.

docker top

The top command lists the processes running within a container.

docker top CONTAINER [ps OPTIONS]



As you can see in the below terminal output, there are 2 processes running in the nginx container.

docker stats

Display a live stream of container(s) resource usage statistics.

docker stats [OPTIONS] [CONTAINER...]



Resource limitation for a docker container

I have not explained to you about resource limitation, but that is the reason why you learning docker. You want to achieve resource isolation as well as assign a certain amount of CPU Core, RAM or Memory to a running container.

  • While launching a container using docker run, you can do the following
  • However, if you already have the container running, use docker update to update the configurations.
    docker update [OPTIONS] CONTAINER [CONTAINER...]

Further reading

This is a short guide page I explained container logs and process management, move to the next section explaining about data/volume management in Docker.