1.關(guān)閉docker
?systemctl stop docker.socket &&?systemctl stop docker.service
//上面的命令無效就用這個看看
systemctl stop docker
2.sudo su切換到root身份
cd /var/lib/docker/containers/容器id/,進(jìn)入對應(yīng)容器目錄
3.vim hostconfig.json
修改如下,將容器目錄/import綁定到主機(jī)/data目錄:
"Binds": ["/data:/import"],
4.vim config.v2.json
修改如下,添加MountPoints:文章來源:http://www.zghlxwxcb.cn/news/detail-511435.html
"MountPoints": {
"/app/docker/my-tengine/conf": {
"Source": "/opt/tengine/conf",
"Destination": "/app/docker/my-tengine/conf",
"RW": true,
"Name": "",
"Driver": "",
"Type": "bind",
"Propagation": "rprivate",
"Spec": {
"Type": "bind",
"Source": "/opt/tengine/conf",
"Target": "/app/docker/my-tengine/conf"
},
"SkipMountpointCreation": false
}
}
5.啟動docker? ?
systemctl start docker.socket &&?systemctl start docker.service文章來源地址http://www.zghlxwxcb.cn/news/detail-511435.html
6.可以進(jìn)入容器查看一下
到了這里,關(guān)于docker給已經(jīng)啟動容器添加掛載目錄的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!