Style:Mac
Series:Java
Since:2018-09-10
End:2018-09-10
Total Hours:1
Degree Of Diffculty:5
Degree Of Mastery:5
Practical Level:5
Desired Goal:5
Archieve Goal:3
Gerneral Evaluation:3
Writer:kingdelee
Related Links:
http://www.cnblogs.com/kingdelee/
方法1,需要重启docker服务,不推荐
1. 查看需要修改的容器,记住container id
docker ps -a
2. 停止容器
docker stop xxx
3. 修改容器的端口映射配置文件
vim /var/lib/docker/containers/{container_id}/hostconfig.json
vim /var/lib/docker/containers/977213f8852b4906d0b5444bfd1345b38f01fc87ddb82895fd8ffc35ffbfcfb2/hostconfig.json
如
需要重启docker服务
systemctl restart docker
方法2 不需要重启docker服务,推荐
1.提交一个运行中的容器为镜像
docker commit containerid foo/live
2.运行镜像并添加端口
docker run -d -p 8000:80 foo/live /bin/bash