• docker-修改容器挂载目录


    1、停止容器

    systemctl stop docker.service
    
    # 一定要停止容器,不然修改无效
    
    #检查容器是否已停止
    docker ps
    

    2、修改挂载点信息

    "MountPoints": {
            "/etc/gitlab-runner": {
                "Source": "/opt/gitlab-runner/config",
                "Destination": "/etc/gitlab-runner",
                "RW": true,
                "Name": "",
                "Driver": "",
                "Type": "bind",
                "Propagation": "rprivate",
                "Spec": {
                    "Type": "bind",
                    "Source": "/opt/gitlab-runner/config",
                    "Target": "/etc/gitlab-runner"
                },
                "SkipMountpointCreation": false
            },
            "/home/gitlab-runner": {
                "Source": "",
                "Destination": "/home/gitlab-runner",
                "RW": true,
                "Name": "27cbde18a296ee3f8cf2744d108e04fec26d0a75ecd1383d9deb4a5f802e26f7",
                "Driver": "local",
                "Type": "volume",
                "Spec": {},
                "SkipMountpointCreation": false
            },
            "/var/run/docker.sock": {
                "Source": "/var/run/docker.sock",
                "Destination": "/var/run/docker.sock",
                "RW": true,
                "Name": "",
                "Driver": "",
                "Type": "bind",
                "Propagation": "rprivate",
                "Spec": {
                    "Type": "bind",
                    "Source": "/var/run/docker.sock",
                    "Target": "/var/run/docker.sock"
                },
                "SkipMountpointCreation": false
            },
            "/opt/maven": {
                "Source": "/opt/maven",
                "Destination": "/opt/maven",
                "RW": true,
                "Name": "",
                "Driver": "",
                "Type": "bind",
                "Propagation": "rprivate",
                "Spec": {
                    "Type": "bind",
                    "Source": "/opt/maven",
                    "Target": "/opt/maven"
                },
                "SkipMountpointCreation": false
            }
        }
    
    # 建议复制一个已有的挂载点,修改成添加的路径,再追加到最后面,要注意在倒数第二个的结尾加“,”
    

    3、重启docker

    systemctl start docker.service
    
    # 确认容器是否启动
    docker ps
    

    4、进去容器查看

    docker exec -it 容器ID  /bin/bash
    
  • 相关阅读:
    单元测试课堂练习
    软件工程个人作业02
    软件工程个人作业01
    构建之法提问
    大道至简-第七、八章-心得体会
    06-接口与继承 动手动脑及验证
    大道至简-第六章-心得体会
    随机生成10个数,填充一个数组,然后用消息框显示数组内容,接着计算数组元素的和,将结果也显示在消息框中。
    大道至简-第五章-心得体会
    字符串加密
  • 原文地址:https://www.cnblogs.com/sandyyeh/p/14916006.html
Copyright © 2020-2023  润新知