1.查看现有的存储卷
[root@centos201 ~]# docker volume ls # 查看现有的存储卷
DRIVER VOLUME NAME
[root@centos201 ~]#
2.创建随机(匿名)的存储卷
[root@centos201 ~]# docker volume create # 创建随机(匿名)的存储卷
050d2f963345d595c827551adc27ee48d61d482bfcf7c86327fddbe03188c4f0
[root@centos201 ~]#
[root@centos201 ~]#
[root@centos201 ~]# docker volume create test01 # 创建自定义名称的存储卷
test01
[root@centos201 ~]#
3.清除未使用的存储卷
[root@centos201 ~]# docker volume prune -f
Deleted Volumes:
050d2f963345d595c827551adc27ee48d61d482bfcf7c86327fddbe03188c4f0
test01
Total reclaimed space: 0B
[root@centos201 ~]#
4.删除指定的存储卷
[root@centos201 ~]# docker volume rm test01
test01
[root@centos201 ~]#
5.查看存储卷的详细信息
[root@centos201 ~]# docker volume inspect test01 # 查看存储卷的详细信息
[
{
"CreatedAt": "2023-06-07T14:51:11+08:00",
"Driver": "local",
"Labels": {},
"Mountpoint": "/var/lib/docker/volumes/test01/_data",
"Name": "test01",
"Options": {},
"Scope": "local"
}
]
[root@centos201 ~]#
标签:存储,持久,centos201,volume,docker,test01,root
From: https://www.cnblogs.com/liuzhonghua1/p/17978408