Contents

Docker system command tutorial: Check disk usage, clean up data, and monitor events

docker system lets you inspect Docker data usage, clean up unused data, and get system information and events. For cleanup, see Freeing disk space to learn how to manage the space Docker uses.

Syntax

docker system df [OPTIONS]
docker system prune [OPTIONS]
docker info [OPTIONS]
docker events [OPTIONS]

docker info and docker system info, and docker events and docker system events, are aliases for the same commands, respectively.

Options

CommandOptionDescription
docker system df--format TEMPLATEFormat output using a custom template; supports table, json, or a Go template
docker system df-v, --verboseShow detailed disk usage information
docker system prune-a, --allRemove all unused images, not just dangling images
docker system prune--filter FILTERFilter what to clean up by condition, such as label=<key>=<value>
docker system prune-f, --forceDo not prompt for confirmation
docker system prune--volumesClean up anonymous volumes
docker info-f, --format TEMPLATEFormat output using a custom template; supports json or a Go template
docker events-f, --filter FILTERFilter output events by the specified condition
docker events--format TEMPLATEFormat output using a custom template; supports json or a Go template
docker events--since TIMEShow events created after the specified time
docker events--until TIMEStream events until the specified time

Examples

Check disk usage and detailed breakdown

$ docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          5         3         420.2MB   239.7MB (57%)
Containers      3         3         139.3kB   0B (0%)
Local Volumes   1         1         3.854MB   0B (0%)
Build Cache     0         0         0B        0B

$ docker system df -v | head -20
Images space usage:

REPOSITORY   TAG           IMAGE ID       CREATED         SIZE      SHARED SIZE   UNIQUE SIZE   CONTAINERS
myweb        snapshot      56e3f92534ca   7 seconds ago   92.1MB    0B            92.08MB       0
nginx        1.30-alpine   47928bf67eb6   3 days ago      93.5MB    12.94MB       80.6MB        1
registry     3             01cd312e6702   3 days ago      86.9MB    12.94MB       73.93MB       1
<none>       <none>        0bf6577d7774   3 days ago      161MB     12.93MB       147.6MB       0
alpine       3.23          ff7f0c727dd7   3 days ago      13MB      12.93MB       86.86kB       1

Containers space usage:

CONTAINER ID   IMAGE               COMMAND                  LOCAL VOLUMES   SIZE      CREATED          STATUS          NAMES
0c009f73010b   alpine:3.23         "sleep 600"              0               4.1kB     42 seconds ago   Up 41 seconds   small
63b9a2f9c63f   nginx:1.30-alpine   "/docker-entrypoint.…"   0               115kB     44 seconds ago   Up 43 seconds   web
35357aad74b1   registry:3          "/entrypoint.sh /etc…"   1               20.5kB    2 minutes ago    Up 2 minutes    registry

Local Volumes space usage:

VOLUME NAME                                                        LINKS     SIZE
21ea99090ddead0461eb5a6efd670e1d9cf58fe9c23d5f8618db5868fb6170aa   1         3.854MB
  • The summary lists the total, active count, size, and reclaimable size for images, containers, local volumes, and build cache.
  • -v lists usage for each image and container. Image details also include shared size, exclusive size, and the number of containers using it.
  • head -20 keeps only the first 20 lines of output, so this breakdown does not show the rest.

Clean up unused data

$ docker system prune -f
Deleted Images:
untagged: sha256:0bf6577d7774e592b29d093e3ac9390eb91e13d72c21e506afce736de5e0eeb0
deleted: sha256:0bf6577d7774e592b29d093e3ac9390eb91e13d72c21e506afce736de5e0eeb0
deleted: sha256:16b124a2d3eacd620d917ead6fd26cbf1f1d7117fa94122398971931cfe2d403
deleted: sha256:f79a7876c6644b273e4eec899344e51c66959237a2f71188db8cb98d7311521c

Total reclaimed space: 147.6MB

$ docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          4         3         272.6MB   92.08MB (33%)
Containers      3         3         139.3kB   0B (0%)
Local Volumes   1         1         3.854MB   0B (0%)
Build Cache     0         0         0B        0B
  • -f makes the cleanup command skip the confirmation prompt. The example removes unused image data and reports reclaiming 147.6MB.
  • The container count is 3 both before and after cleanup; the image count drops from 5 to 4, and total size drops from 420.2MB to 272.6MB.
  • --all can clean up all unused images, and --volumes can clean up anonymous volumes. First make sure you do not need to keep the data.

Get system information with a format template

$ docker info --format '{{.ServerVersion}} {{.Driver}} {{.Containers}} containers, {{.Images}} images'
29.9.2 overlayfs 3 containers, 5 images
  • --format limits the output to the server version, storage driver, container count, and image count specified in the template.
  • The example shows server version 29.9.2 and storage driver overlayfs.

View events by time and condition

$ timeout 3 docker events --since 30s --format '{{.Type}} {{.Action}} {{.Actor.Attributes.name}}' ; true
container top web
container top web
container kill busy
network disconnect bridge
container die busy
container destroy busy
image save sha256:47928bf67eb62a1863cb08d9ecb52d3e704304ba614eaee17884204677702951
image save sha256:47928bf67eb62a1863cb08d9ecb52d3e704304ba614eaee17884204677702951
image untag nginx:1.30-alpine
image load sha256:47928bf67eb62a1863cb08d9ecb52d3e704304ba614eaee17884204677702951
container exec_create: sh -c echo hello > /usr/share/nginx/html/hi.txt web
container exec_start: sh -c echo hello > /usr/share/nginx/html/hi.txt web
container exec_die web
container export web
image tag myweb:snapshot
image import sha256:56e3f92534ca8c5aedd8de576ae2433f1864d3d3b51de847a8dc8dd7d503da4d
container create sharp_gould
container attach sharp_gould
network connect bridge
container start sharp_gould
network disconnect bridge
container die sharp_gould
container destroy sharp_gould
container prune <no value>
network prune <no value>
image untag sha256:0bf6577d7774e592b29d093e3ac9390eb91e13d72c21e506afce736de5e0eeb0
image delete sha256:0bf6577d7774e592b29d093e3ac9390eb91e13d72c21e506afce736de5e0eeb0
builder prune <no value>

$ docker events --since 10s --until 0s --filter type=container --format '{{.Action}} {{.Actor.Attributes.name}}'
prune <no value>
create evt
attach evt
start evt
die evt
destroy evt
  • The first example streams events from the last 30 seconds and outputs only the event type, action, and name; timeout 3 limits how long it runs.
  • The second example uses --filter type=container to limit output to container events, and --since and --until to set the time range.
  • The name field for prune events shows <no value> because the event has no name value for this template to read.

Exercises

Exercise: List only container events from the last 10 seconds, outputting the event action and container name.

Answer
docker events --since 10s --until 0s --filter type=container --format '{{.Action}} {{.Actor.Attributes.name}}'

FAQ

What is UNIQUE SIZE in docker system df -v?

It lists the exclusive size of an image; the output also lists SIZE and SHARED SIZE. For example, alpine:3.23 has a SIZE of 13MB, a SHARED SIZE of 12.93MB, and a UNIQUE SIZE of 86.86kB.

Does docker system prune delete images in use?

In the example, it deletes dangling images that no containers use and reports reclaiming 147.6MB; 3 active containers remain after cleanup. --all expands the cleanup scope to all unused images, while --volumes also cleans up anonymous volumes.

Can docker events show only container events?

Yes. Use --filter type=container. Combine it with --since and --until to limit the event time range, and use --format to choose the event fields to output.

How do I get only the Docker version and image count from docker info?

Use docker info --format to specify Go template fields; the example output is 29.9.2 overlayfs 3 containers, 5 images.

Updated October 26, 2026