docker-system
Manage Docker system resources and information
TLDR
Display help
Show Docker disk usage
Show detailed information on disk usage
Remove unused data (append --volumes to remove unused volumes as well)
Remove unused data created more than a specified amount of time in the past
Display real-time events from the Docker daemon
Display real-time events from containers streamed as valid JSON Lines
Display system-wide information
SYNOPSIS
docker system [OPTIONS] COMMAND
Subcommands:
df Show Docker disk usage
events Get real time events from the server
info Display system-wide information
prune Remove unused Docker data
Usage examples:
docker system info
docker system df -v
docker system prune -a --volumes
docker system events --filter 'type=container'
PARAMETERS
--verbose, -v
Used with `df` to show more detailed information.
--filter, -f
Used with `events` to filter output (e.g., `type=container`). Also used with `prune` to filter items to be removed.
--since
Used with `events` to show events since a given timestamp or relative time.
--until
Used with `events` to show events until a given timestamp or relative time.
--format, -f
Used with `info` to format output using a Go template.
--all, -a
Used with `prune` to remove all unused images, not just dangling ones.
--force, -f
Used with `prune` to not prompt for confirmation.
--volumes
Used with `prune` to also prune volumes not used by at least one container.
DESCRIPTION
The `docker system` command provides utilities for managing and monitoring the Docker daemon and its associated resources. It allows users to inspect system-wide information, view disk usage by Docker objects, prune unused data to free up space, and stream real-time events from the Docker daemon. It's crucial for maintaining a healthy and optimized Docker environment, especially on systems with limited disk space or requiring continuous monitoring and cleanup practices. This command centralizes several system-level operations, simplifying administrative tasks and improving overall Docker host hygiene.
CAVEATS
docker system prune can be destructive. Always use with caution, especially with -a or --volumes, as it permanently removes data. Requires the Docker daemon to be running and accessible. Users must be part of the `docker` group or use `sudo` to execute these commands.
DISK USAGE ANALYSIS
docker system df provides a quick overview of how much space Docker is consuming, categorized by images, containers, local volumes, and build cache. This is invaluable for troubleshooting disk space issues and identifying areas for cleanup.
RESOURCE MANAGEMENT
docker system prune is the primary tool for reclaiming disk space by removing unused images, containers, volumes, and build cache. Regular pruning is a good practice for maintaining a lean Docker installation and preventing disk space exhaustion on Docker hosts.
HISTORY
The `docker system` command was introduced as part of Docker's evolution to provide a centralized interface for system-wide operations. Subcommands like `info`, `df`, and `prune` consolidate functionalities that might have previously been spread across other `docker` subcommands or required manual inspection of disk usage. The `prune` functionality became particularly important as Docker usage grew, leading to the accumulation of dangling or unused resources that could consume significant disk space.