$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 828f9911e9ce ghcr.io/hongfs/env:golang-signal "./main" 55 minutes ago Up 55 minutes 80/tcp hongfs_web.3.7wqdim5z7hsksdi1kuv5febgi cc2268a9c95a ghcr.io/hongfs/env:golang-signal "./main" 56 minutes ago Up 56 minutes 80/tcp hongfs_web.4.eu98e6roc600k7ubmcvdxkb1d 0f71f604059f ghcr.io/hongfs/env:golang-signal "./main" 56 minutes ago Up 56 minutes 80/tcp hongfs_web.1.rfmkxg8zsg7109r8louipqyud 394ae065d7e5 ghcr.io/hongfs/env:golang-signal "./main" 57 minutes ago Up 57 minutes 80/tcp hongfs_web.2.z6k6aacmkm6gk6jnqd9beok8f
进行更新,切记一定要带上镜像,提前 docker pull 来更新镜像是不行的。
1 2 3 4 5 6 7
$ docker service update --image ghcr.io/hongfs/env:golang-signal --force hongfs_web hongfs_web overall progress: 1 out of 4 tasks 1/4: running [==================================================>] 2/4: 3/4: 4/4:
更新完成后重新看容器列表
1 2 3 4 5 6
$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 028f049ee6bf ghcr.io/hongfs/env:golang-signal "./main" 19 minutes ago Up 19 minutes 80/tcp hongfs_web.1.tu75a0m946v4cxosqoagrhkqk fb211f11d1d9 ghcr.io/hongfs/env:golang-signal "./main" 20 minutes ago Up 20 minutes 80/tcp hongfs_web.4.ls3jogwefrcc55u0rfs7v6pji 2097bdfdaacc ghcr.io/hongfs/env:golang-signal "./main" 20 minutes ago Up 20 minutes 80/tcp hongfs_web.2.uhro1mmi5z8fkofw22xnpqzn1 5bbd87f9c48b ghcr.io/hongfs/env:golang-signal "./main" 21 minutes ago Up 21 minutes 80/tcp hongfs_web.3.f3yb4wttoh9gd2fz02odwyhjo