YouTip LogoYouTip

Docker Volume Command

# docker volume Command [![Image 3: Docker Command Manual](#)Docker Command Manual](#) * * * The `docker volume` command is used to manage Docker volumes. Volumes are file systems used for persistent data storage, which can be shared and reused across containers. By using volumes, data can be retained even when containers are stopped or removed. ### Common `docker volume` Commands 1. **`docker volume ls`**: List all volumes 2. **`docker volume inspect`**: View detailed information of a volume 3. **`docker volume create`**: Create a new volume 4. **`docker volume rm`**: Remove one or more volumes 5. **`docker volume prune`**: Remove unused volumes ### `docker volume ls` Command List all volumes. docker volume ls Output: DRIVER VOLUME NAME local my_volume local another_volume ### docker volume inspect Command View detailed information of a specified volume. docker volume inspect my_volume Output: [ { "CreatedAt": "2024-07-23T00:00:00Z", "Driver": "local", "Labels": {}, "Mountpoint": "/var/lib/docker/volumes/my_volume/_data", "Name": "my_volume", "Options": {}, "Scope": "local" }] ### docker volume create Command Create a new volume. docker volume create my_volume **Common Parameters** * **`--driver`**: Specify the volume driver (default is `local`). * **`--label`**: Add a label to the volume. * **`-o, --opt`**: Specify driver options for the volume. Example: docker volume create --name my_volume --label project=my_project ### docker volume rm Command Remove one or more volumes. docker volume rm my_volume Remove multiple volumes: docker volume rm volume1 volume2 ### docker volume prune Command Remove unused volumes. docker volume prune ### Use Cases * **Persistent Data**: Volumes are used to persist data, so data remains even if the container is deleted. * **Shared Data**: Volumes can share data across multiple containers. * **Backup and Recovery**: Volumes can be used to backup and restore container data. * **Separation of Data and Application**: Volumes separate data from applications, making management and migration easier. The `docker volume` command set provides powerful data management features, allowing users to create, configure, and manage Docker volumes. By using these commands, users can achieve data persistence, sharing, and backup to meet various data management needs. * * Docker Command Manual](#)
← Zig SetupLinux Comm Ssh β†’