Docker Swarm:第二次执行时,Docker堆栈部署失败

时间:2020-06-16 08:53:26

标签: docker cluster-computing docker-swarm docker-registry swarm

我有一个刚用docker swarm init创建的单节点docker群。

我有一个docker-stack.yml,其中包含以下部署:

version: '3.3'

services:

  website:
    image: docker.pkg.github.com/foo/bar/bar:latest
    ports:
      - "80:80"
      - "443:443"
    environment:
      HOST: bar.com
    secrets:
      - site.key
      - site.cert
    networks:
      - foo-net

networks:
  foo-net:
    driver: overlay
    external: true

secrets:
  site.key:
    external: true
  site.cert:
    external: true

首先,我登录到注册表,它告诉我登录成功。 其次,我部署堆栈

$ docker stack deploy --with-registry-auth --compose-file docker-stack.yml foo
 Creating service foo_bar

此后,该服务正在运行,并且一切正常。

但是,当我尝试第二次(几秒钟后)使用同一命令部署堆栈时,它失败并显示以下消息。

$ docker stack deploy --with-registry-auth --compose-file docker-stack.yml foo
Updating service foo_website (id: uvtqpdx74784dy9egj5i1c7sb)
image docker.pkg.github.com/foo/bar/bar:latest could not be accessed on a registry to record
its digest. Each node will access docker.pkg.github.com/foo/bar/bar:latest independently,
possibly leading to different nodes running different
versions of the image

为什么会这样?

所有网络和秘密都是预先创建的,我的docker版本是:

$ docker version
Client:
 Version:           19.03.6
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        369ce74a3c
 Built:             Fri Feb 28 23:45:43 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          19.03.6
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       369ce74a3c
  Built:            Wed Feb 19 01:06:16 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.3.3-0ubuntu1~18.04.2
  GitCommit:        
 runc:
  Version:          spec: 1.0.1-dev
  GitCommit:        
 docker-init:
  Version:          0.18.0
  GitCommit:

感谢您的帮助! 谢谢

0 个答案:

没有答案
相关问题