赞
踩
docker stop 容器ID
systemctl stop docker
先进入目录
cd /var/lib/docker/containers/容器ID*
hostconfig.json
文件vi hostconfig.json
找到类似如下字段:
"PortBindings": {
"111/tcp": [ //容器端口1
{
"HostIp": "",
"HostPort": "111" //宿柱机端口1
}
],
"222/tcp": [ //容器端口2
{
"HostIp": "",
"HostPort": "222" //宿柱机端口2
}
]
}
按照json
文件格式添加或修改成需要的端口号即可
config.v2.json
文件 修改两处:
"ExposedPorts": {
"111/tcp": {},
"222/tcp": {}
}
"Ports": { "111/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "111" }, { "HostIp": "::", "HostPort": "111" } ], "222/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "222" }, { "HostIp": "::", "HostPort": "222" } ] }
和修改hostconfig.json
文件类似,符合json
语法格式即可
docker
systemctl restart docker
docker restart 容器ID
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。