Images
A Docker image is a package containing everything required by an app to run.
sudo docker image pull redis:latest
sudo docker image ls
# redis latest d2e4e1f51132 5.8MB
# Search Docker Hub
sudo docker search mongodb --filter "is-official=true"
# mongo MongoDB document databases provide high avai…
# mongo-express Web-based MongoDB admin interface, written w…
Use rmi to remove a Docker image.
docker rmi web.latest
# Untagged: web.latest:latest
docker rmi test
# Untagged: test:latest
docker image ls
# REPOSITORY TAG IMAGE ID CREATED SIZE
# web latest 58188456312c 26 hours ago 81.9MB
# alpine latest 0ac33e5f5afa 4 weeks ago 5.57MB
Commands
Those are the main command related to managing docker images.
docker images
# You can remove one container image.
docker rmi IMAGE_ID
# If can force the deletion with -f flag
docker rmi -f 1df330ae0770
# You can list all containers, including stopped ones
docker ps -a
# You can remove stopped containers
docker rm CONTAINER_ID
# You can remove all stopped containers at once
docker container prune
# You can remove all Docker images at once by using the docker image prune command
docker image prune -a
# You can remove all images except for the latest tag
docker images -q -f "dangling=false" | xargs docker rmi -f
Last update: 302 days ago