How can I delete Docker's images?

后端 未结 17 1197
执笔经年
执笔经年 2020-11-29 14:27

I\'ve the following images:

alex@alexvps:~$ sudo docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
&         


        
17条回答
  •  [愿得一人]
    2020-11-29 15:01

    If you want to automatically/periodically clean up exited containers and remove images and volumes that aren't in use by a running container you can download the Docker image meltwater/docker-cleanup.

    That way you don't need to go clean it up by hand.

    Just run:

    docker run -d -v /var/run/docker.sock:/var/run/docker.sock:rw  -v /var/lib/docker:/var/lib/docker:rw --restart=unless-stopped meltwater/docker-cleanup:latest
    

    It will run every 30 minutes (or however long you set it using DELAY_TIME=1800 option) and clean up exited containers and images.

    More details: https://github.com/meltwater/docker-cleanup/blob/master/README.md

提交回复
热议问题