docker-compose推送图像到AWS ECR [英] docker-compose push image to aws ecr
问题描述
是否可以让docker-compose既构建映像又将其推送到远程仓库?现在我要做
is it possible to have docker-compose both build an image and push it to a remote repo? right now I do the
docker-compose
build然后我做
docker-compose config --services
通过名称循环遍历图像名和标签,然后执行
loop through the names reconstruct the imagename and the tag, then do
docker push blah
似乎有一种方法也可以要求它也进行推送。
Seems like there mush be a way to just ask it to push as well.
推荐答案
在 https:// docs处的文档中查看此摘要。 docker.com/compose/compose-file/#build :
如果同时指定了图像和构建,则撰写用webapp和图像中指定的可选标签命名生成的
图像:
If you specify image as well as build, then Compose names the built image with the webapp and optional tag specified in image:
build: ./dir
image: webapp:tag
这将产生一个名为
webapp和带有标记标签的图像,该图像是从./dir构建的。
This will result in an image named webapp and tagged tag, built from ./dir.
您至少可以在映像名称前添加映像存储库。然后,您应该可以将 docker-compose push
与更新版本的Docker Compose一起使用。
You could at least prepend the image repository in the image name. Then you would should be able to use docker-compose push
with newer versions of Docker Compose.
这篇关于docker-compose推送图像到AWS ECR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!