“docker system” Command Examples

The “docker system” command is a versatile tool provided by Docker that allows you to manage Docker data and obtain system-wide information about your Docker environment.

When you use the “docker system” command, it provides various subcommands that enable you to perform tasks related to Docker data management and system information retrieval. Here are some key subcommands:

  • docker system df“: This subcommand displays a summary of the disk usage related to Docker. It provides information about the space occupied by containers, images, volumes, and other Docker objects. This can help you identify and clean up unused or unnecessary resources to free up disk space.
  • docker system events“: With this subcommand, you can view real-time events occurring within your Docker environment. These events include container creations, starts, stops, image pulls, network creations, and more. It is useful for monitoring and troubleshooting activities happening in your Docker system.
  • docker system info“: This subcommand presents detailed information about your Docker installation. It includes details such as the number of containers and images, Docker version, operating system details, available resources, and network configurations. It provides a comprehensive overview of your Docker setup.
  • docker system prune“: By executing this subcommand, you can remove unused Docker resources to reclaim disk space. It cleans up stopped containers, dangling images, unused networks, and unused volumes. It is a useful command for performing routine maintenance and keeping your Docker environment clean.
  • docker system prune -a“: This variation of the “docker system prune” command goes a step further and removes all unused Docker resources, including stopped containers, unused images, networks, and volumes. It is particularly helpful when you want to completely clean up your Docker system.
  • docker system version“: This subcommand provides version information for Docker components, including the client and server versions. It displays the API version, Git commit details, and other relevant version information.

These are just a few examples of the subcommands available under “docker system”. Each subcommand serves a specific purpose related to Docker data management and system-wide information retrieval. Using these commands, you can efficiently manage Docker resources, monitor events, and gain insights into your Docker environment.

docker system Command Examples

1. Show help:

# docker system

2. Show docker disk usage:

# docker system df

3. Show detailed information on disk usage:

# docker system df --verbose

4. Remove unused data:

# docker system prune

5. Remove unused data created more than a specified amount of time in the past:

# docker system prune --filter="until=[hours]h[minutes]m"

6. Display real-time events from the Docker daemon:

# docker system events

7. Display real-time events from containers streamed as valid JSON Lines:

# docker system events --filter 'type=container' --format 'json .'

8. Display system-wide information:

# docker system info
Related Post