docker

Remove a Local Docker Image Tag Without Deleting the Image


I'm new on the containers world and I recently have started with Docker. But I'm having some issues, and I couldn't find a solution ( at least one I understand minimally). So, here's the problem:

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
helloworld1         latest              8916c2510f76        3 hours ago         148MB
hiworld             latest              8916c2510f76        3 hours ago         148MB

Thanks in advance.


Solution

  • docker rmi (the remove image command) does this.

    $ docker rmi hiworld:latest
    

    That will untag hiworld:latest, but will leave helloworld1:latest (and 8916c2510f76) in place. According to the docs,

    If an image has one or more tags referencing it, you must remove all of them before the image is removed.