ubuntu:docker:remove_an_image
Differences
This shows you the differences between two versions of the page.
ubuntu:docker:remove_an_image [2019/11/27 01:15] – created peter | ubuntu:docker:remove_an_image [2020/04/15 22:07] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Ubuntu - Docker - Remove an image ====== | ||
- | |||
- | ===== Find the image ===== | ||
- | |||
- | <code bash> | ||
- | docker images | ||
- | </ | ||
- | |||
- | returns: | ||
- | |||
- | <code bash> | ||
- | REPOSITORY | ||
- | ubuntu | ||
- | ubuntu | ||
- | ubuntu | ||
- | hello-world | ||
- | docker/ | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | Now remove an image | ||
- | |||
- | <code bash> | ||
- | docker rmi image_name | ||
- | </ | ||
- | |||
- | Seeing all created containers is as simple as docker ps -a. | ||
- | |||
- | To remove all existing containers (not images!) run docker rm $(docker ps -aq) | ||
- | |||
- | ---- | ||
- | |||
- | ===== Removing images according to a pattern ===== | ||
- | |||
- | You can find all the images that match a pattern using a combination of docker images and grep. Once you're satisfied, you can delete them by using awk to pass the IDs to docker rmi. Note that these utilities are not supplied by Docker and are not necessarily available on all systems: | ||
- | |||
- | |||
- | To find the images: | ||
- | |||
- | <code bash> | ||
- | docker ps -a | grep " | ||
- | </ | ||
- | |||
- | To remove the images: | ||
- | |||
- | <code bash> | ||
- | docker images | grep " | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Remove all images ===== | ||
- | |||
- | All the Docker images on a system can be listed by adding -a to the docker images command. | ||
- | |||
- | To list the images: | ||
- | |||
- | <code bash> | ||
- | docker images -a | ||
- | </ | ||
- | |||
- | |||
- | To remove the images: | ||
- | |||
- | <code bash> | ||
- | docker rmi $(docker images -a -q) | ||
- | </ | ||
ubuntu/docker/remove_an_image.1574817319.txt.gz · Last modified: 2020/07/15 09:30 (external edit)