修改已运行 docker 容器的端口绑定、重启策略


参考:https://www.cnblogs.com/shijf/p/10386193.html

https://www.cnblogs.com/myfqm/p/13086125.html

https://www.cnblogs.com/zhuochong/p/10070516.html

1、停止容器,然后找到容器的对应配置文件:/var/lib/docker/containers/[hash_of_the_container]/hostconfig.json

2、修改后保存(如修改端口绑定:PortBindings、重启策略:RestartPolicy)

3、重启 docker:systemctl restart docker

4、通过 docker inspect [hash_of_the_container] 命令可以查看当前容器的配置

5、通过 docker update --restart always [hash_of_the_container] 可以直接修改容器的重启策略


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM