Can't tag docker image after successfully create image using docker-compose build (Error response from daemon)

huangapple go评论62阅读模式
英文:

Can't tag docker image after successfully create image using docker-compose build (Error response from daemon)

问题

PS C:path> docker-compose up --build      
[+] 构建中 0.0秒 (0/0)
...
...

我假设这成功了,

PS C:path> docker-compose ps
名称                镜像                    命令                  服务             创建时间             状态              端口
kafka               wurstmeister/kafka       "start-kafka.sh"         kafka               2小时前         上线 2小时          0.0.0.0:9092->9092/tcp
mysql               mysql:latest             "docker-entrypoint.s…"   db                  2小时前         上线 2小时          0.0.0.0:3306->3306/tcp, 33060/tcp
zookeeper           wurstmeister/zookeeper   "/bin/sh -c '/usr/sb…"   zookeeper           2小时前         上线 2小时          22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp
PS C:path> docker tag backend:latest xxx.dkr.ecr.region.amazonaws.com/backend:latest
守护进程的错误响应: 没有这样的镜像: backend:latest

当我运行 docker images

镜像仓库                                标签       镜像ID       创建时间         大小
mysql                                      latest    c71276df4a87   8天前      565MB
ambassador/telepresence-docker-extension   1.0.8     bb2143440bbd   2周前     528MB
ambassador/telepresence-docker-runtime     1.0.8     a1a178ca4417   2周前     21.3MB
redis                                      latest    0ec8ab59a35f   2周前     117MB
postgres                                   15.2      bf700010ce28   5周前     379MB
docker/welcome-to-docker                   latest    b1eb53af308a   7周前     13.6MB
wurstmeister/kafka                         latest    a692873757c0   12个月前   468MB
wurstmeister/zookeeper                     latest    3f43f72cb283   4年前     510MB
英文:
PS C:path> docker-compose up --build      
[+] Building 0.0s (0/0)
...
...

I assume this is successful,

PS C:path> docker-compose ps
NAME                IMAGE                    COMMAND                  SERVICE             CREATED             STATUS              PORTS
kafka               wurstmeister/kafka       "start-kafka.sh"         kafka               2 hours ago         Up 2 hours          0.0.0.0:9092->9092/tcp
mysql               mysql:latest             "docker-entrypoint.s…"   db                  2 hours ago         Up 2 hours          0.0.0.0:3306->3306/tcp, 33060/tcp
zookeeper           wurstmeister/zookeeper   "/bin/sh -c '/usr/sb…"   zookeeper           2 hours ago         Up 2 hours          22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp
PS C:path> docker tag backend:latest xxx.dkr.ecr.region.amazonaws.com/backend:latest
Error response from daemon: No such image: backend:latest

When I run docker images

REPOSITORY                                 TAG       IMAGE ID       CREATED         SIZE
mysql                                      latest    c71276df4a87   8 days ago      565MB
ambassador/telepresence-docker-extension   1.0.8     bb2143440bbd   2 weeks ago     528MB
ambassador/telepresence-docker-runtime     1.0.8     a1a178ca4417   2 weeks ago     21.3MB
redis                                      latest    0ec8ab59a35f   2 weeks ago     117MB
postgres                                   15.2      bf700010ce28   5 weeks ago     379MB
docker/welcome-to-docker                   latest    b1eb53af308a   7 weeks ago     13.6MB
wurstmeister/kafka                         latest    a692873757c0   12 months ago   468MB
wurstmeister/zookeeper                     latest    3f43f72cb283   4 years ago     510MB

答案1

得分: 1

你需要先检查图像是否存在。
下面的命令可以列出图像。

docker images

之后,您可以标记图像并将其推送到远程存储库。

docker tag backend:latest xxx.dkr.ecr.region.amazonaws.com/backend:latest && docker push xxx.dkr.ecr.region.amazonaws.com/backend:latest
英文:

You need to check if the image exists first.
The command below is possible to list the images.

docker images

After that, you can tag the image and push that to a remote repository.

docker tag backend:latest xxx.dkr.ecr.region.amazonaws.com/backend:latest && docker push xxx.dkr.ecr.region.amazonaws.com/backend:latest

huangapple
  • 本文由 发表于 2023年6月13日 14:48:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76462296.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定