您好,登錄后才能下訂單哦!
docker添加掛載目錄:先在docker容器里創建目錄/import
1.關閉docker:/etc/init.d/docker stop
2.sudo su切換到root身份,cd /var/lib/docker/containers/容器id/,進入對應容器目錄
3.vi hostconfig.json,修改如下,將容器目錄/import綁定到主機/data目錄:
"Binds": ["/data:/import"],
4.vi config.v2.json,修改如下,添加MountPoints:
"MountPoints": {
"/import": {
"Source": "/data",
"Destination": "/import",
"RW": true,
"Name": "",
"Driver": "",
"Type": "bind",
"Propagation": "rprivate",
"Spec": {
"Type": "bind",
"Source": "/data",
"Target": "/import"
},
"SkipMountpointCreation": false
}
},
5.啟動docker:/etc/init.d/docker start
最后docker ecec -it 容器id /bin/bash進入ls -l /就可以看見import目錄
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。