目前,我的 docker 设置中有 8 个容器跨 4 台不同的主机。
ubuntu@ip-192-168-1-8:~$ docker service ls
ID NAME MODE REPLICAS IMAGE
yyyytxxxxx8 mycontainers global 8/8 myapplications:latest
ps -a
在服务上产生以下结果。ubuntu@ip-192-168-1-8:~$ docker service ps -a yy
NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
mycontainers1 myapplications:latest: ip-192-168-1-5 Running Running 3 hours ago
\_ mycontainers2 myapplications:latest: ip-192-168-1-6 Running Running 3 hours ago
\_ mycontainers3 myapplications:latest: ip-192-168-1-7 Running Running 3 hours ago
\_ mycontainers4 myapplications:latest: ip-192-168-1-8 Running Running 3 hours ago
\_ mycontainers1 myapplications:latest: ip-192-168-1-5 Running Running 3 hours ago
\_ mycontainers2 myapplications:latest: ip-192-168-1-6 Running Running 3 hours ago
\_ mycontainers3 myapplications:latest: ip-192-168-1-7 Running Running 3 hours ago
\_ mycontainers4 myapplications:latest: ip-192-168-1-8 Running Running 3 hours ago
在最新的稳定版docker 1.12.x中,可以通过更新服务配置来重启容器,但是在即将发布的docker 1.13.0中,即使服务设置没有改变,通过指定--force
标志,容器将重新启动。如果您不介意使用 1.13.0 RC4,您现在可以使用。
$ docker service update --force mycontainers
关于docker - 如何在 docker swarm 中重启多个容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41388183/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |