Skip to main content

Posts

Showing posts from May, 2023

Copy Docker Image From one Repo to Another Repository

This Blog would help you on how you can copy one docker image to another repository, this is useful when people want to host their own docker registry and copy the images there. FROM AWS ECR to private repo Create file copy-docker-image.sh repo="ACCOUNT_ID.dkr.ecr.ap-south-1.amazonaws.com" aws ecr get-login-password --region ap-south-1 | sudo docker login --username AWS --password-stdin $repo push_repo="172.31.1.250:5000" sudo docker pull $repo/$1 sudo docker tag $repo/$1 $push_repo/$2:$3 sudo docker push $push_repo/$2:$3 Note: Make sure you have aws cli setup with aws configure with correct credentials to pull the image DOCKER hub to private repo Create file copy-docker-image.sh repo="docker.io" push_repo="172.31.1.250:5000" sudo docker pull $repo/$1 sudo docker tag $repo/$1 $push_repo/$2:$3 sudo docker push $push_repo/$2:$3 Usage chmod +x copy-docker-image.sh ./copy-docker-image.sh nginx:1.24 nginx v1.24