Created
January 3, 2018 12:56
-
-
Save B-Stefan/b586f134ccc14bd8f983b2403423a99a to your computer and use it in GitHub Desktop.
Docker check if tag exists
This file contains 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
export DOCKER_TAG=test | |
if [[ $( docker pull hello-world:$DOCKER_TAG 2>&1 | head -1 ) == *"not found"* ]] ; | |
then | |
echo "Create image for hello world repro" | |
docker pull hello-world:develop | |
docker tag hello-world:develop hello-world:$DOCKER_TAG | |
docker push hello-world:$DOCKER_TAG | |
else | |
echo "Image already exists" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script checks if a specific tag exists.
If the tag was found the pull will be canceled and not downloaded!