Вы можете перечислить все изображения, которые вы загрузили или установили, используя
docker images -a
You can remove an image with
docker rmicommand, passing the name of the image you want to remove. This will remove the image.
Sometimes when testing and developing, some images become dangling, which means untagged images. They can always be safely removed to free disk space.
docker images -f dangling=truewill list them:
And you can clear them with
docker rmi $(docker images -f dangling=true -q). This command will only eliminate dangling images used in containers, even if not currently running.
docker system prune -a, which is also a commonly used way to remove images, will also remove images not referenced by any container, which might remove images you might want to keep, even just to rollback to previous versions of an image.
You can also remove all images using
docker rmi $(docker images -a -q)if you want to clean everything, which might be nice during your first tests and experiments with Docker.
More docker tutorials:
- Introduction to Docker
- Introduction to Docker Images
- Introduction to Docker Containers
- Installing Docker on macOS
- First steps with Docker after the installation
- Using Docker Desktop to manage a Container
- Create a simple Node.js Hello World Docker Container from scratch
- What to do if a Docker container immediately exits
- Working with Docker Containers from the command line
- Working with Docker Images from the command line
- Sharing Docker Images on Docker Hub
- How to access files outside a Docker container
- How to commit changes to a Docker image
- Updating a deployed container based on a Docker image