官术网_书友最值得收藏!

Clearing and cleaning Docker images

Since we will be using Docker to build container images, it will be useful to know how to get rid of images. You have already seen the list of images with the docker image command. There are also intermediate images that are maintained by Docker that are hidden in that output. To see all the images that Docker is storing, use the following command:

docker images -a

If you have only pulled the alpine image as per the preceding text, you likely won't see any additional images, but as you build images in the next chapter, this list will grow.

You can remove images with the docker rmi command followed by the name of the image. By default, Docker will attempt to maintain images that containers have used recently or referenced. Because of this, you may need to force the removal to clean up the images.

If you want to reset and remove all the images and start afresh, there is a handy command that will do that. By tying together Docker images and docker rmi, we can ask it to force remove all the images it knows about:

docker rmi -f $(docker images -a -q)
主站蜘蛛池模板: 威信县| 五大连池市| 大冶市| 沅江市| 车致| 庆元县| 民乐县| 桂林市| 石景山区| 富裕县| 广安市| 湄潭县| 西林县| 永德县| 麻江县| 长宁县| 类乌齐县| 观塘区| 凉城县| 通榆县| 黎城县| 大田县| 怀柔区| 乳源| 大姚县| 徐闻县| 荔浦县| 安泽县| 和政县| 景洪市| 饶河县| 札达县| 临颍县| 秀山| 福州市| 丰都县| 定兴县| 阜阳市| 阿克陶县| 洞口县| 饶河县|