github.com/olljanat/moby@v1.13.1/docs/reference/commandline/rmi.md (about)

     1  ---
     2  title: "rmi"
     3  description: "The rmi command description and usage"
     4  keywords: "remove, image, Docker"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # rmi
    17  
    18  ```markdown
    19  Usage:  docker rmi [OPTIONS] IMAGE [IMAGE...]
    20  
    21  Remove one or more images
    22  
    23  Options:
    24    -f, --force      Force removal of the image
    25        --help       Print usage
    26        --no-prune   Do not delete untagged parents
    27  ```
    28  
    29  You can remove an image using its short or long ID, its tag, or its digest. If
    30  an image has one or more tag referencing it, you must remove all of them before
    31  the image is removed. Digest references are removed automatically when an image
    32  is removed by tag.
    33  
    34      $ docker images
    35      REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    36      test1                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    37      test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    38      test2                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    39  
    40      $ docker rmi fd484f19954f
    41      Error: Conflict, cannot delete image fd484f19954f because it is tagged in multiple repositories, use -f to force
    42      2013/12/11 05:47:16 Error: failed to remove one or more images
    43  
    44      $ docker rmi test1
    45      Untagged: test1:latest
    46      $ docker rmi test2
    47      Untagged: test2:latest
    48  
    49      $ docker images
    50      REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    51      test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    52      $ docker rmi test
    53      Untagged: test:latest
    54      Deleted: fd484f19954f4920da7ff372b5067f5b7ddb2fd3830cecd17b96ea9e286ba5b8
    55  
    56  If you use the `-f` flag and specify the image's short or long ID, then this
    57  command untags and removes all images that match the specified ID.
    58  
    59      $ docker images
    60      REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    61      test1                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    62      test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    63      test2                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    64  
    65      $ docker rmi -f fd484f19954f
    66      Untagged: test1:latest
    67      Untagged: test:latest
    68      Untagged: test2:latest
    69      Deleted: fd484f19954f4920da7ff372b5067f5b7ddb2fd3830cecd17b96ea9e286ba5b8
    70  
    71  An image pulled by digest has no tag associated with it:
    72  
    73      $ docker images --digests
    74      REPOSITORY                     TAG       DIGEST                                                                    IMAGE ID        CREATED         SIZE
    75      localhost:5000/test/busybox    <none>    sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf   4986bf8c1536    9 weeks ago     2.43 MB
    76  
    77  To remove an image using its digest:
    78  
    79      $ docker rmi localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
    80      Untagged: localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
    81      Deleted: 4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125
    82      Deleted: ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2
    83      Deleted: df7546f9f060a2268024c8a230d8639878585defcc1bc6f79d2728a13957871b