Table: docker_volume - Query Docker Volumes using SQL
Docker Volumes are a type of resource provided by the Docker service that allows persistent data storage and sharing among containers. They are designed to decouple the life of the data being stored from the life of the container, enabling data to persist even after a container is deleted. Docker Volumes are managed directly by Docker and are stored in a part of the host filesystem which is managed by Docker.
Table Usage Guide
The docker_volume
table provides insights into Docker Volumes within Docker. As a DevOps engineer, explore volume-specific details through this table, including driver, labels, options, and scope. Utilize it to uncover information about volumes, such as those with specific labels, the options set for each volume, and the scope of each volume.
Examples
List all volumes
Explore all the storage volumes within your Docker environment to understand the usage and allocation. This can be beneficial for managing storage resources and optimizing performance.
select *from docker_volume;
select *from docker_volume;
Find all volumes with a given label
Identify all Docker volumes that are labeled as 'postgres'. This is useful for managing and organizing your Docker volumes, especially in large systems where volumes may not be consistently labeled.
select *from docker_volumewhere labels ->> 'com.docker.compose.volume' = 'postgres';
select *from docker_volumewhere json_extract(labels, '$.com.docker.compose.volume') = 'postgres';
Schema for docker_volume
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
created | timestamp with time zone | Time when the volume was created. | |
driver | text | Name of the volume driver used by the volume. | |
labels | jsonb | Labels for the volume. | |
mountpoint | text | Mount path of the volume on the host. | |
name | text | Name of the volume. | |
options | jsonb | The driver specific options used when creating the volume. | |
scope | text | The level at which the volume exists. Either global for cluster-wide, or local for machine level. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
status | jsonb | Low-level details about the volume, provided by the volume driver. | |
usage_data | jsonb | Usage data for the volume. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- docker
You can pass the configuration to the command with the --config
argument:
steampipe_export_docker --config '<your_config>' docker_volume