问题原文
原帖链接 · Mihai · CC BY-SA 3.0
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"!
社区高分解答
原帖链接 · Travis Rennemann · CC BY-SA 4.0
Starting from an empty docker repo, import an image by typing:
#docker run hello-world
Run the docker images command to list the images. The result should look like this:
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 7bc42cc48a84 4 weeks ago 316MB
Now let's create an image tag called v1 by running the docker tag command:
#docker tag hello-world:latest hello-world:v1
If we run the docker images command we'll see our new tag like this:
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 7bc42cc48a84 4 weeks ago 316MB
hello-world v1 7bc42cc48a84 4 weeks ago 316MB
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:
#docker rmi hello-world:v1
Untagged: hello-world:v1
Run the docker images command to list the images. Notice that the image tag has been removed:
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest 7bc42cc48a84 4 weeks ago 316MB
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
