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
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}}")
.Use either an image ID or a tag
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:
If the image was in use you can force removing by using –