Docker: How to delete all local Docker images

后端 未结 16 2310
梦谈多话
梦谈多话 2021-01-29 17:24

I recently started using Docker and never realized that I should use docker-compose down instead of ctrl-c or docker-compose stop to get r

16条回答
  •  無奈伤痛
    2021-01-29 17:36

    To delete all images :

    docker rmi $(docker images -a -q)
    

    where -a is all, and -q is return only image ids

    To remove unused images, and containers :

    docker system prune
    

    beware as if you are using docker swarm, and your local machine is joining remote swarm (as manager/worker), your local will be the deployed repo. executing this thus removes the deployed images.

提交回复
热议问题