skip to Main Content

I have several Docker images on my pc

PS C:docker_tstarchive> docker image ls
REPOSITORY                                 TAG          IMAGE ID       CREATED         SIZE
redis                                      5-alpine     2d3a8f80f74a   10 days ago     29.3MB
postgres                                   9.6-alpine   67ff6cfc14c1   2 weeks ago     37.2MB
chirpstack/chirpstack-network-server       3            d3e0d2166375   3 weeks ago     32.1MB
eclipse-mosquitto                          2            9c9838e94223   4 weeks ago     9.83MB
chirpstack/chirpstack-application-server   3            aa5d46b94d83   5 weeks ago     43.4MB
chirpstack/chirpstack-gateway-bridge       3            f1bc9870476a   5 weeks ago     19.6MB
chirpstack/chirpstack-geolocation-server   3            4aa9ff39264a   16 months ago   20.7MB

Trying remove one of them:

PS C:docker_tstarchive> docker image rm redis

Got error:

Error: No such image: redis

Why docker can’t find this immage?

3

Answers


  1. Use the IMAGE ID: docker image rm 2d3a8f80f74a.
    You’re trying to remove a image based on repository and you might have more than one image for repository (e.g: php:7.2-apache, php:7.2-cli, php:latest).

    If you wanna remove all images from the same repository you can do docker rmi $(docker images redis --format "{{.ID}}").

    Login or Signup to reply.
  2. Use either an image ID or a tag

    ❯ docker image list
    REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
    python       3.8       9b9126f2a963   10 days ago   883MB
    ❯ docker image remove python
    Error: No such image: python
    ❯ docker image remove python:3.8
    Untagged: python:3.8
    Untagged: python@sha256:82a4aa8ff9e7f0c6a9463b12bb53fc37d9e084bcd5c6d38f38c8fdb3613fd46f
    Deleted: sha256:9b9126f2a9634e2f8fe3ae6a574ed10b0d757b1c22418dc25c482df98c049b51
    
    
    Login or Signup to reply.
  3. Because you are removing the image based on image name, so you should give the version or it would be assumed that version is latest.
    so use this command to remove the image by name:

    docker image rm redis:5-alpine
    

    If the image was in use you can force removing by using –

    docker image rm redis:5-alpine -f
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search