简体   繁体   English

运行docker push to ECR时找不到Docker映像

[英]Docker image not found when running docker push to ECR

I have this working in development (because everything is on one machine), but on production I have a docker swarm with managers and worker nodes. 我正在开发中工作(因为一切都在一台机器上),但是在生产中,我有一个带有管理者和工作者节点的docker群。 When I run docker commit it creates a snapshot and running docker image ls confirms this, but when I try to push to a private registry (ecr) docker cannot find the image. 当我运行docker commit它将创建一个快照,并运行docker image ls确认了这一点,但是当我尝试推送到私有注册表(ecr)时,docker无法找到该映像。 I guess this is because the image is on the worker and the manager cannot find it, or the image is on the manager and the worker cannot find it. 我猜这是因为图像在工作人员上并且经理找不到它,或者图像在管理人员上而工人找不到它。 How can I fix this? 我怎样才能解决这个问题?

{ 
  Error: '(HTTP code 404) no such image - No such image: {account-id}.dkr.ecr.us-east-1.amazonaws.com/{repo}:{tag}'
    at /root/labs/node_modules/docker-modem/lib/modem.js:257:17
    at getCause (/root/labs/node_modules/docker-modem/lib/modem.js:287:7)
    at Modem.buildPayload (/root/labs/node_modules/docker-modem/lib/modem.js:256:5)
    at IncomingMessage.<anonymous> (/root/labs/node_modules/docker-modem/lib/modem.js:232:14)
    at Object.apply (/root/labs/node_modules/harmony-reflect/reflect.js:2064:37)
    at IncomingMessage.emit (events.js:187:15)
    at Object.apply (/root/labs/node_modules/harmony-reflect/reflect.js:2064:37)
    at IncomingMessage.EventEmitter.emit (domain.js:441:20)
    at endReadableNT (_stream_readable.js:1094:12)
    at Object.apply (/root/labs/node_modules/harmony-reflect/reflect.js:2064:37)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  reason: 'no such image',
  statusCode: 404,
  json: { 
    message: 'No such image: {account-id}.dkr.ecr.us-east-1.amazonaws.com/{repo}:{tag}' 
  }
} 

I ended up solving this issue by logging into the worker that ran the container. 我最终通过登录运行容器的工人来解决了这个问题。 Running docker container commit saves a snapshot of the image in the local repo, which is located on the node the container is running on. 运行docker容器提交会在本地仓库中保存映像的快照,该快照位于容器正在运行的节点上。 If that node is on another host, which was my case, running docker push image will not work because the manager will not have access to the workers local repo. 如果该节点在另一台主机上(我就是这种情况),则运行docker push镜像将不起作用,因为管理器将无法访问worker本地存储库。 So just connect to the worker directly and run docker push image. 因此,直接连接到工作程序并运行docker push image。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM