Day 16 Task: Docker for DevOps Engineers.

Manasa JManasa J
3 min read

Docker stats

docker stats is a command in Docker that provides real-time metrics about the containers running on your system. It displays a live stream of various resource usage statistics, such as CPU usage, memory usage, network I/O, and more for each container.

The docker stats command displays the following metrics for each running container:

  • CONTAINER ID: The unique identifier for the container.

  • NAME: The name of the container.

  • CPU %: The percentage of CPU usage the container is using.

  • MEM USAGE / LIMIT: The amount of memory the container is using and the memory limit.

  • MEM %: The percentage of the memory limit being used by the container.

  • NET I/O: The network input/output (in bytes) for the container.

  • BLOCK I/O: The block input/output (disk I/O) for the container.

  • PIDS: The number of processes or threads the container is using.

Docker inspect

The docker inspect command provides detailed information about Docker objects, such as containers, images, volumes, and networks. It returns data in JSON format, allowing you to view and analyze a wide range of properties and configurations.

The docker inspect command returns a JSON object containing detailed information. For containers, this might include:

  • ID: The container's unique identifier.

  • State: Current state of the container (e.g., running, exited).

  • Image: The image the container is based on.

  • Config: Configuration settings, such as environment variables and command line arguments.

  • Mounts: Information about volumes and bind mounts.

  • NetworkSettings: Network configuration, including IP address and port mappings.

Docker top

The docker top command is used to display the running processes within a Docker container. It provides a view similar to the ps command on Linux, showing the processes that are currently running in a specified container.

Output

The output of docker top will typically include columns like:

  • PID: The process ID inside the container.

  • USER: The user who owns the process.

  • TIME: The amount of CPU time the process has consumed.

  • COMMAND: The command that started the process.

Docker load

The docker load command is used to load a Docker image from a tarball (.tar) file. This is particularly useful for importing images that were previously saved using the docker save command or for transferring Docker images between systems without using a Docker registry.

Docker save

The docker save command is used to export one or more Docker images to a tarball (a .tar file). This command is useful for creating backups of Docker images, transferring them between systems, or storing them in an archive.

THANK YOU FOR READING!

Do follow me on LinkedIn for further blogs.

linkedin.com/in/manasa-j-03b633238

0
Subscribe to my newsletter

Read articles from Manasa J directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Manasa J
Manasa J