CodeBlanks Logo Icon CodeBlanks

docker info

Learn to get system status with docker info.

docker info

docker info shows the daemon's detailed state: how many containers are running or stopped, how many images there are, the storage driver (usually overlay2), the Docker root directory, and the amount of CPU and memory.

$ docker info
Containers: 3
 Running: 1
 Paused: 0
 Stopped: 2
Images: 5
Storage Driver: overlay2
Docker Root Dir: /var/lib/docker

Disk usage

Docker takes up a lot of space over time. docker system df shows the space used by images, containers, volumes and the build cache; docker system prune cleans up the unused ones:

$ docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          5         2         1.2GB     800MB (66%)
Containers      3         1         20MB      15MB (75%)
$ docker system prune     # removes stopped containers, unused networks and dangling images

Practice State and cleanup

Write three commands: show the daemon information, show the disk usage, then clean up the unused items without asking for confirmation (-f).

Starter code

terminal
# buraya yaz

Sample solution

terminal
docker info
docker system df
docker system prune -f

Expected output

Containers: 3
 Running: 1
Total reclaimed space: 815MB

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Where are image and container layers stored by default on Linux?

  • /etc/docker
  • /home/docker
  • /tmp
  • /var/lib/docker Correct answer

Explanation: "Docker Root Dir" in the docker info output shows this path.

2 Show Docker's disk usage.

Question
docker system ____
Answer
docker system df

Explanation: docker system df gives a summary by type.

3 Match.

Term Meaning
docker info Daemon state
docker system df Disk usage
docker system prune Removes unused items
overlay2 Storage driver

All lessons in Beginner