Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 699 Bytes

docker-cheatsheet.md

File metadata and controls

42 lines (30 loc) · 699 Bytes

Docker Cheatsheet

Get the list of all images

$ docker images

Remove single images

$ docker rmi IMAGE_NAME

You can use first three digits of Image ID instead of Image Name. For example, if Image ID is 7b66156f376c,

$ docker rmi 7b6

Stop all containers

$ docker stop $(docker ps -a -q)

Remove all containers

$ docker rm $(docker ps -a -q)

Remove all images

$ docker rmi $(docker images -qf "dangling=true")

Remove all images except some images

Remove all images except ubuntu and my-image

$ docker rmi $(docker images | grep -v 'ubuntu\|my-image' | awk {'print $3'})