nair-r / docker-cheat-sheet

Quick reference guide for Docker commands

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-cheat-sheet

Quick reference guide for Docker commands - not at all exhaustive, just a cheat sheet.

Building/Running

task command

Monitoring/Removing Images

task command
remove all untagged images docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
remove dangling images docker rmi $(docker images -q -f dangling=true)

Monitoring/Killing Containers

task command notes
see running containers docker ps like ps in bash!
see most recently launched container docker ps -l -l for last
see all containers docker ps -a -a for all
see hash of running containers docker ps -q -q for hash
see hash of most recent container docker ps -ql mix -q and -l for hash of last
see hash of all containers docker ps -aq ditto for -a and -q
kill all running containers docker kill $(docker ps -q) kill only stops running containers
kill most recent container docker kill $(docker ps -ql)
remove all exited containers docker rm $(docker ps -qa) rm only removes exited containers
remove all containers docker rm -f $(docker ps -qa) -f forces rm to kill and remove
remove old containers docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs docker rm removes containers that are created weeks ago

About

Quick reference guide for Docker commands

License:Apache License 2.0