Let's say I want to tag a Docker image, and make a typo. How do I remove the tag without removing the image itself? Neither the manpages nor the Docker documentation mention removing tags.
docker tag 0e5574283393 my-imaj
docker tag 0e5574283393 my-image
# docker untag my-imaj # There is no "docker untag"!
If your image is tagged with more than one tag, then
docker rmi
will remove the tag, but not the image.So in your example ...
... will remove that tag and leave the image present with the other correct tag.
Run
docker rmi REPOSITORY:TAG
to remove the tag.The
REPOSITORY
andTAG
values come fromdocker images
output.For example
Starting from an empty docker repo, import an image by typing:
Run the
docker images
command to list the images. The result should look like this:Now let's create an image tag called v1 by running the
docker tag
command:If we run the
docker images
command we'll see our new tag like this:To delete a specific tag (to answer the original question), run the docker rmi
hello-world:v1
where v1 is the tag name. The output will look like this:Run the
docker images
command to list the images. Notice that the image tag has been removed:Tag other image with you tag name and afterwards your tag from your current image will be removed.