github.com/slene/docker@v1.8.0-rc1/docs/reference/commandline/rmi.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "rmi"
     4  description = "The rmi command description and usage"
     5  keywords = ["remove, image, Docker"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  weight=1
     9  +++
    10  <![end-metadata]-->
    11  
    12  # rmi
    13  
    14      Usage: docker rmi [OPTIONS] IMAGE [IMAGE...]
    15  
    16      Remove one or more images
    17  
    18        -f, --force=false    Force removal of the image
    19        --no-prune=false     Do not delete untagged parents
    20  
    21  
    22  You can remove an image using its short or long ID, its tag, or its digest. If
    23  an image has one or more tag or digest reference, you must remove all of them
    24  before the image is removed.
    25  
    26      $ docker images
    27      REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    28      test1                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    29      test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    30      test2                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    31  
    32      $ docker rmi fd484f19954f
    33      Error: Conflict, cannot delete image fd484f19954f because it is tagged in multiple repositories, use -f to force
    34      2013/12/11 05:47:16 Error: failed to remove one or more images
    35  
    36      $ docker rmi test1
    37      Untagged: test1:latest
    38      $ docker rmi test2
    39      Untagged: test2:latest
    40  
    41      $ docker images
    42      REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    43      test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    44      $ docker rmi test
    45      Untagged: test:latest
    46      Deleted: fd484f19954f4920da7ff372b5067f5b7ddb2fd3830cecd17b96ea9e286ba5b8
    47  
    48  If you use the `-f` flag and specify the image's short or long ID, then this
    49  command untags and removes all images that match the specified ID.
    50  
    51      $ docker images
    52      REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    53      test1                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    54      test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    55      test2                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    56  
    57      $ docker rmi -f fd484f19954f
    58      Untagged: test1:latest
    59      Untagged: test:latest
    60      Untagged: test2:latest
    61      Deleted: fd484f19954f4920da7ff372b5067f5b7ddb2fd3830cecd17b96ea9e286ba5b8
    62  
    63  An image pulled by digest has no tag associated with it:
    64  
    65      $ docker images --digests
    66      REPOSITORY                     TAG       DIGEST                                                                    IMAGE ID        CREATED         VIRTUAL SIZE
    67      localhost:5000/test/busybox    <none>    sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf   4986bf8c1536    9 weeks ago     2.43 MB
    68  
    69  To remove an image using its digest:
    70  
    71      $ docker rmi localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
    72      Untagged: localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
    73      Deleted: 4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125
    74      Deleted: ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2
    75      Deleted: df7546f9f060a2268024c8a230d8639878585defcc1bc6f79d2728a13957871b
    76