前言
之前开放端口,少开放了一些端口,所以需要进行调整,具体步骤如下
内容
停止服务
##停止容器服务 docker stop <container id> ##停止docker服务 systemctl stop docker
修改配置
配置目录
cd /var/lib/docker/containers/4fd7*/
修改hostconfig.json
中的PortBindings
vim hostconfig.json "PortBindings":{"2222/tcp":[{"HostIp":"","HostPort":"2222"}],"5000/tcp":[{"HostIp":"","HostPort":"5000"}],"80/tcp":[{"HostIp":"","HostPort":"40001"}],"8070/tcp":[{"HostIp":"","HostPort":"8070"}],"8081/tcp":[{"HostIp":"","HostPort":"8081"}]},
"80/tcp":[{"HostIp":"","HostPort":"40001"}]
80 容器内部端口
40001 外部映射端口
修改config.v2.json
中的ExposedPorts
vi config.v2.json "ExposedPorts":{"2222/tcp":{},"5000/tcp":{},"80/tcp":{},"8081/tcp":{},"8070/tcp":{}},
重启服务
## 启动docker服务 systemctl start docker ## 启动容器 docker start <container id>
验证
docker ps -a
学无止境,谦卑而行.