简体   繁体   中英

How to use a base image for docker and build your own image out of it?

I have found a docker image that has everything i need to setup my application but its large to download so that's why i'm trying to download it to AWS ECR so that the build process can speed up is there any way i can pull docker image and use that as a base to build my own?

Thanks

You can pull the image and push it to AWS ECR. You need to create the repo in AWS first. 在此处输入图像描述

# 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

Yes, you can use any image as base image. You can use the image you push to AWS ECR too, at the top of your Dockerfile add below code:

FROM <account_id>.dkr.ecr.<region>.amazonaws.com/<repo_name>:<image_tag>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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