Created
March 8, 2016 19:41
-
-
Save gdumitrescu/0ddaf2af111254045775 to your computer and use it in GitHub Desktop.
publish docker image to dockerhub with a provided name
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
#!/usr/bin/env bash | |
# get docker image name from input | |
docker_image=$1 | |
# remove local docker image | |
docker rmi $docker_image | |
# build new docker image | |
docker build . | |
# get the ID of new dangling image | |
docker_image_id=$(docker images -q --filter dangling=true) | |
# tag docker image | |
docker tag "$docker_image_id" "$docker_image" | |
# push docker image | |
docker push $docker_image |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment