Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
publish docker image to dockerhub with a provided name
#!/usr/bin/env bash
# get docker image name from input
# 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