• Docker容器修改端口映射


    • 先停容器和docker服务
    docker stop [容器id]
    systemctl stop docker
    • 查询容器完整CONTAINER ID
    docker inspect【CONTAINER ID】| grep Id
    • 修改容器配置文件 hostconfig.json 、config.v2.json
    cd /var/lib/docker/containers/容器完整id
    hostconfig.json参照已有映射修改、新增
        "PortBindings": {
            "10081/tcp": [{
                    "HostIp": "",
                    "HostPort": "10081"
                }
            ],
            "10081/udp": [{
                    "HostIp": "",
                    "HostPort": "10081"
                }
            ],
            "80/tcp": [{
                    "HostIp": "",
                    "HostPort": "8888"
                }
            ]
        },
    config.v2.json
    
    
    
        "Config": {
            "Hostname": "a1b9dc131fa6",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "10081/tcp": {},
                "10081/udp": {},
                "443/tcp": {},
                "80/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": ["KUBOARD_ENDPOINT=http://192.168.137.2:8888", "KUBOARD_AGENT_SERVER_UDP_PORT=10081", "KUBOARD_AGENT_SERVER_TCP_PORT=10081", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "TZ=Asia/Shanghai", "KUBOARD_PROXY_COOKIE_TTL=36000", "KUBOARD_SERVER_LOGRUS_LEVEL=info", "KUBOARD_UI_DIR=/kuboard-ui", "KUBOARD_SERVER_PORT=80", "KUBOARD_TLS_CACHE=/data/autocert/.cache", "GIN_MODE=release", "KUBOARD_ETCD_ENDPOINTS=127.0.0.1:2379", "KUBOARD_LOGIN_TYPE=default", "KUBOARD_ROOT_USER=admin", "GITLAB_BASE_URL=https://gitlab.com", "LDAP_SKIP_SSL_VERIFY=true"],
            "Cmd": null,
            "Image": "eipwork/kuboard:v3",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": ["/entrypoint.sh"],
            "OnBuild": null,
            "Labels": {
                "maintainer": "shaohq@foxmail.com"
            }
        }
    • 重启
    systemctl start docker
    docker start [docker id]
  • 相关阅读:
    Mybatis配置数据库连接
    C# 解决httplistener querystring 中文乱码、返回json中文格式乱码
    C# Base64加解密、MD5加密
    C# 获取时间戳并从10进制时间戳转换成16进制byte数组
    win10删除文件夹需要Administrator权限
    WordPress所有页面404 分类页面导航也找不到文章
    Maven配置阿里云镜像
    Hexo部署GitHub Pages
    Linux常用命令集合
    jmeter性能测试入门使用参数化
  • 原文地址:https://www.cnblogs.com/cyh1282656849/p/14906560.html
Copyright © 2020-2023  润新知