Skip to content

Instantly share code, notes, and snippets.

@marufmax
Last active May 11, 2021 05:24
Show Gist options
  • Save marufmax/46b6c679c315732feb0f67e45533cf32 to your computer and use it in GitHub Desktop.
Save marufmax/46b6c679c315732feb0f67e45533cf32 to your computer and use it in GitHub Desktop.

Docker Commands

Some docker commands I found useful on internet. Instead of searching them everytime this is where I do keep track of them 🎉

Remove and Kill all running containers

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

Purging All unused images, containers, volumes and networks

docker system prune

Remove All Images:

docker images -a // get images
docker rmi Image Image // remove image 

------ Dangling images ----
docker images -f dangling=true 
docker images purge

## Remove all images
docker rmi -f $(docker images -a -q)

Removing Volumes

docker volume ls
docker volume rm volume_name volume_name

------ Dangling Volumes ----
docker volume ls -f dangling=true
docker volume prune

Boring Theories:

We are developers we don't read text, we read codes 😆

but it's good to have some knowledge before digging into commands 👊

dangling: Dangling images are layers that have no relationship to any tagged images. They no longer serve a purpose and consume disk space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment