Commands of Docker Volumes
The following are some of the commands of docker volumes:
Purpose |
Docker Command |
---|---|
To create a docker volume |
docker volume create <Name of the volume> |
To list all the docker volumes present in the docker |
docker volume ls |
To inspect the docker volume |
docker volume inspect <Name of the volume> |
To remove the docker volume |
docker volume rm <Name of the docker volume> |
To remove all the unused volumes |
docker volume prune |
To attach the volumes to the running in the docker container. |
docker run -v <Name of the Volume>:<Path of the volume> |
To copy the data between the containers |
docker cp <Name Of Volume> :<Path><host path> |
Using CLI to Manage Docker Volumes
If you want to share files and directories among multiple Docker Containers, you can easily mount Docker Volumes to different Containers. However, managing such a large number of Docker Volumes becomes very difficult at times. In this article, we are going to discuss how to manage Docker Volumes by executing commands through the Docker Command Line Interface (CLI).
Table of Content
- What are Docker Volumes?
- Why use Docker Volumes?
- Commands of Docker Volumes
- How Does Volume Work in Docker?
- Examples to Implement Docker Volume Commands
- How to Removing specific Docker Volume?
- How to Removing all the Docker Volumes?
- Advantages of Docker Volumes
- How do you clean up docker volumes?
- Why to clean Docker Volumes?