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

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值