如何为docker使用基础映像并从中构建您自己的映像?

我发现了一个Docker映像,该映像具有设置我的应用程序所需的一切,但它具有很大的下载空间,因此这就是为什么我尝试将其下载到AWS ECR以便可以加快构建过程的原因拉docker镜像并以此为基础构建自己的镜像?

谢谢

hwzzwc 回答:如何为docker使用基础映像并从中构建您自己的映像?

您可以拉出图像并将其推送到AWS ECR。 您需要首先在AWS中创建存储库。 enter image description here

# Tag your image so you can push the image to this repository
docker tag <image_name>:latest <account_id>.dkr.ecr.<region>.amazonaws.com/<repo_name>:latest
# Push this image to your AWS repository
docker push <account_id>.dkr.ecr.<region>.amazonaws.com/<repo_name>:latest

是的,您可以将任何图像用作基本图像。您也可以使用推送到AWS ECR的图像,在Dockerfile的顶部添加以下代码:

FROM <account_id>.dkr.ecr.<region>.amazonaws.com/<repo_name>:<image_tag>
本文链接:https://www.f2er.com/2465066.html

大家都在问