0


docker给已经启动容器添加挂载目录

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": {
        "/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:/etc/init.d/docker start

6.可以进入容器查看一下.

标签: docker 容器 运维

本文转载自: https://blog.csdn.net/lcc2001/article/details/129270589
版权归原作者 奇怪的点 所有, 如有侵权,请联系我们删除。

“docker给已经启动容器添加挂载目录”的评论:

还没有评论