当前位置:网站首页>Anonymous Mount & named mount
Anonymous Mount & named mount
2022-06-28 02:23:00 【Late stage big face sprouting of lazy cancer】
# Mount anonymously
-v Container path
[[email protected] volumes]# docker run -d -P --name nginx02 -v /ect/nginx nginx # -P Random port
1e7a6f078e1d149a28870b080e8889fa943c0a3be94cb98b34e4b68fbaca7706
[[email protected] volumes]# docker volume --help
Usage: docker volume COMMAND
Manage volumes
Commands:
create Create a volume
inspect Display detailed information on one or more volumes
ls List volumes
prune Remove all unused local volumes
rm Remove one or more volumes
Run 'docker volume COMMAND --help' for more information on a command.
# View all volume situation
[[email protected] volumes]# docker volume ls # The following are all anonymous volume mounts , stay -v Only the path in the container is written , No path outside the container is written
DRIVER VOLUME NAME
local 85ceb1c90bf20638336243eba9185d8f733c19785e70699e95511e5022167d41
local 378d3ad8f128323116b58484f5fd19492b4e41d1213f729ed89cfc9c7f3524bc
local 94004da9bc144582354a4fa694fc647b7d700512eb1d0b220f47de9a521da753
local 40506974fbded9e29a84f42f33b737e28dc13eb0a821f1ebd991aa349bfac1bc
local aaac05064af330ebf935a3c42bf51f49aa82f319714b9e865fed5f875ee885ef
local c2956de8052af73afc7e00ebdc74f9a2f17e8f794bf551ce09fd45598e58c94f
# View where the volume is located :Mountpoint
[[email protected] ~]# docker volume inspect 85ceb1c90bf20638336243eba9185d8f733c19785e70699e95511e5022167d41
[
{
"CreatedAt": "2022-05-06T13:29:50+08:00",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/85ceb1c90bf20638336243eba9185d8f733c19785e70699e95511e5022167d41/_data",
"Name": "85ceb1c90bf20638336243eba9185d8f733c19785e70699e95511e5022167d41",
"Options": null,
"Scope": "local"
}
]# Mount with a name
-v Volume name : Container path
[[email protected] ~]# docker run -d -P --name nginx03 -v juming-nginx:/etc/nginx nginx
f89ab2645fc6cea48003e98d080b37d5aa5d3485740ee1d34df128c4872edcef
[[email protected] ~]# docker volume ls
DRIVER VOLUME NAME
local 2eba47cade6c5b68f4f2179df0511e49113f4c507aad448b2bc25fbb99cc4ecf
local 5f5d46c0cfe40408f71515d12b6d2bab31cfbe478716f125bab34d43c65e0776
local 54c20bfffe906d311d4394dccb85c4f7f2d2cee4ed295ff9682856a7c2a7d07b
local 85ceb1c90bf20638336243eba9185d8f733c19785e70699e95511e5022167d41
local 378d3ad8f128323116b58484f5fd19492b4e41d1213f729ed89cfc9c7f3524bc
local 94004da9bc144582354a4fa694fc647b7d700512eb1d0b220f47de9a521da753
local 40506974fbded9e29a84f42f33b737e28dc13eb0a821f1ebd991aa349bfac1bc
local aaac05064af330ebf935a3c42bf51f49aa82f319714b9e865fed5f875ee885ef
local c2956de8052af73afc7e00ebdc74f9a2f17e8f794bf551ce09fd45598e58c94f
local ccd77d73028a70a3433a374aea57d9e2c96828cddefe1a808eda0354ba3b7a44
local juming-nginx
[[email protected] ~]# docker volume inspect juming-nginx
[
{
"CreatedAt": "2022-05-29T14:43:14+08:00",
"Driver": "local",
"Labels": null,
"Mountpoint": "/var/lib/docker/volumes/juming-nginx/_data",
"Name": "juming-nginx",
"Options": null,
"Scope": "local"
}
]
all docker The volume in the container , No directory specified ( You can use docker info Command view Directory ) In the case of..., the default is /var/lib/docker/volumes/xxx/_data Under the table of contents


We can easily find the volume through the named mount , In most cases, a named mount is used
-v / Container path # Mount anonymously
-v Volume name :/ Container path # Mount with a name
-v / Host path :/ Container path # Specify the path to mount , This method does not produce anonymous volumes
expand
# adopt -v Container path :ro rw Change read and write permissions
ro readonly -- read-only
rw readwrite -- Can read but write
docker run -d -P --name nginx03 -v juming-nginx:/etc/nginx:ro nginx
# Just see ro This means that this path can only be operated by the host , The container cannot be cleaned , The default is rw
边栏推荐
- 766. 托普利茨矩阵
- Jenkins - 訪問 Jenkins 自定義參數變量,處理變量值中含有空格
- 面试官问:能否模拟实现JS的new操作符
- How to handle computer security certificate errors
- General process after reference layer reboot
- Numpy----np. meshgrid()
- Cesium anti aliasing (lines, borders, etc.)
- SQL 注入繞過(二)
- 【sylixos】NEW_1 型字符驱动示例
- Differences between cesium polygon extrudedheight and height
猜你喜欢
随机推荐
I/o limit process and CPU limit process
What are the risks of opening a compass stock account? Is it safe to open a compass account
Numpy----np.tile()函数解析
Description du format geojson (détails du format)
mysql面试百题集
利用redis bitmap实现人员在线情况监控
Raspberry pie realizes intelligent cooling by temperature control fan
Appium自动化测试基础 — ADB常用命令(一)
Figure out the difference between MIT, BSD and Apache open source protocols
[sylixos] I2C device driver creation and use
[Yongyi XY chair] trial experience
Embedded must learn, detailed explanation of hardware resource interface -- Based on arm am335x development board (Part 1)
Scoped attribute and lang attribute in style
Cesium Color 颜色(赋值)随机颜色
Cesium color color (assignment) random color
How fiddle uses agents
Centos8 operation record command version Yum redis MySQL Nacos JDK
pytorch_ lightning. utilities. exceptions. MisconfigurationException: You requested GPUs: [1] But...
面试官问:能否模拟实现JS的new操作符
SQL 注入绕过(三)









