cru*_*der 6 docker docker-swarm
我目前在docker设置中有4个不同主机的8个容器.
ubuntu@ip-192-168-1-8:~$ docker service ls
ID NAME MODE REPLICAS IMAGE
yyyytxxxxx8 mycontainers global 8/8 myapplications:latest
Run Code Online (Sandbox Code Playgroud)
运行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
Run Code Online (Sandbox Code Playgroud)
我的问题是如何使用服务ID执行所有容器的重启?我不想手动登录每个节点并执行重启.
在docker 1.12.x的最新稳定版本中,可以通过更新服务配置来重新启动容器,但是在即将发布的docker 1.13.0中,即使服务设置未更改,通过指定--force标志,容器将重新启动.如果你不介意使用1.13.0 RC4,你现在可以做到.
$ docker service update --force mycontainers
Run Code Online (Sandbox Code Playgroud)
更新:Docker 1.13.0已经发布.
https://github.com/docker/docker/releases/tag/v1.13.0
| 归档时间: |
|
| 查看次数: |
7964 次 |
| 最近记录: |