github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/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  # rmi
     8  
     9  ```markdown
    10  Usage:  docker rmi [OPTIONS] IMAGE [IMAGE...]
    11  
    12  Remove one or more images
    13  
    14  Options:
    15    -f, --force      Force removal of the image
    16        --help       Print usage
    17        --no-prune   Do not delete untagged parents
    18  ```
    19  
    20  ## Description
    21  
    22  Removes (and un-tags) one or more images from the host node. If an image has
    23  multiple tags, using this command with the tag as a parameter only removes the
    24  tag. If the tag is the only one for the image, both the image and the tag are
    25  removed.
    26  
    27  This does not remove images from a registry. You cannot remove an image of a
    28  running container unless you use the `-f` option. To see all images on a host
    29  use the [`docker image ls`](images.md) command.
    30  
    31  ## Examples
    32  
    33  You can remove an image using its short or long ID, its tag, or its digest. If
    34  an image has one or more tags referencing it, you must remove all of them before
    35  the image is removed. Digest references are removed automatically when an image
    36  is removed by tag.
    37  
    38  ```bash
    39  $ docker images
    40  
    41  REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    42  test1                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    43  test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    44  test2                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    45  
    46  $ docker rmi fd484f19954f
    47  
    48  Error: Conflict, cannot delete image fd484f19954f because it is tagged in multiple repositories, use -f to force
    49  2013/12/11 05:47:16 Error: failed to remove one or more images
    50  
    51  $ docker rmi test1:latest
    52  
    53  Untagged: test1:latest
    54  
    55  $ docker rmi test2:latest
    56  
    57  Untagged: test2:latest
    58  
    59  
    60  $ docker images
    61  
    62  REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    63  test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    64  
    65  $ docker rmi test:latest
    66  
    67  Untagged: test:latest
    68  Deleted: fd484f19954f4920da7ff372b5067f5b7ddb2fd3830cecd17b96ea9e286ba5b8
    69  ```
    70  
    71  If you use the `-f` flag and specify the image's short or long ID, then this
    72  command untags and removes all images that match the specified ID.
    73  
    74  ```bash
    75  $ docker images
    76  
    77  REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
    78  test1                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    79  test                      latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    80  test2                     latest              fd484f19954f        23 seconds ago      7 B (virtual 4.964 MB)
    81  
    82  $ docker rmi -f fd484f19954f
    83  
    84  Untagged: test1:latest
    85  Untagged: test:latest
    86  Untagged: test2:latest
    87  Deleted: fd484f19954f4920da7ff372b5067f5b7ddb2fd3830cecd17b96ea9e286ba5b8
    88  ```
    89  
    90  An image pulled by digest has no tag associated with it:
    91  
    92  ```bash
    93  $ docker images --digests
    94  
    95  REPOSITORY                     TAG       DIGEST                                                                    IMAGE ID        CREATED         SIZE
    96  localhost:5000/test/busybox    <none>    sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf   4986bf8c1536    9 weeks ago     2.43 MB
    97  ```
    98  
    99  To remove an image using its digest:
   100  
   101  ```bash
   102  $ docker rmi localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
   103  Untagged: localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf
   104  Deleted: 4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125
   105  Deleted: ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2
   106  Deleted: df7546f9f060a2268024c8a230d8639878585defcc1bc6f79d2728a13957871b
   107  ```