Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have two docker images that I would like to remove, but it seems that they cannot be removed with docker image prune -a. Why? The two images are not used in the terminal, since I just restarted the terminal.

(base) ~ % docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
test_docker         latest              245e34778213        10 minutes ago      1.34GB
<none>              <none>              02f2aa7b08bb        41 minutes ago      1.21GB
(base) ~ % docker image prune -a
WARNING! This will remove all images without at least one container associated to them.
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B

How can I remove the images?

question from:https://stackoverflow.com/questions/65909509/not-being-able-to-remove-docker-images-with-docker-image-prune-a

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
290 views
Welcome To Ask or Share your Answers For Others

1 Answer

You'll need to make sure all Docker containers are stopped and removed, after that you can remove the Docker images.

Stop and remove all docker containers and images:

  1. List all containers (only IDs) docker ps -aq.
  2. Stop all running containers. docker stop $(docker ps -aq)
  3. Remove all containers. docker rm $(docker ps -aq)
  4. Remove all images. docker rmi $(docker images -q) or docker image prune -a

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...