Created
September 18, 2022 13:30
-
-
Save ntheanh201/dae8a7b6456729d032da8f89c87c188b to your computer and use it in GitHub Desktop.
Migrate docker image from Docker Hub to Github Container Registry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
read -p "Enter docker image: " image | |
read -p "Enter source docker image tag: " tag | |
read -p "Enter target docker image tag: " target_tag | |
github_user="ntheanh201" | |
docker_image="$github_user/$image:$tag" | |
new_image="ghcr.io/$github_user/$image:$target_tag" | |
echo "image: $docker_image" | |
echo "new image: $new_image" | |
docker pull $docker_image | |
docker tag $docker_image $new_image | |
docker push $new_image | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment