Docker 活动容器实例 增加目录映射 -v
添加 /data/soft:/data/soft 目录映射 1、在容器目录下下载sz config.v2.json、hostconfig.json两个文件,修改它们 cd /var/lib/docker/containers/7c3d7013f94801666841f55165646d414b17792de0c3890a4e7b98693a8a2218 config.v2.json
"AutoRemove": false,
"Binds": [
"/etc/init.d/DockerCentos7_startsh:/etc/init.d/sh",
"/data/soft:/data/soft" 增加此行
],
hostconfig.json
"MountPoints": {
"/etc/init.d/sh": {
"Destination": "/etc/init.d/sh",
"Driver": "",
"Name": "",
"Propagation": "rprivate",
"RW": true,
"Source": "/etc/init.d/DockerCentos7_startsh",
"Spec": {
"Source": "/etc/init.d/DockerCentos7_startsh",
"Target": "/etc/init.d/sh",
"Type": "bind"
},
"Type": "bind"
}, 这里有一个,逗号
"/data/soft": {
增加这一段
"Destination": "/data/soft",
"Driver": "",
"Name": "",
"Propagation": "rprivate",
"RW": true,
"Source": "/data/soft",
"Spec": {
"Source": "/data/soft",
"Target": "/data/soft",
"Type": "bind"
},
"Type": "bind"
}
},
2、关闭docker systemctl stop docker 3、上传两个文件,上传之前可以把旧文件直接rm -rf删除 4、启动docker systemctl start docker
--------------------------------------end
