DEV Community

Cover image for Docker Cheatsheet

Docker Cheatsheet

Mrinalini Sugosh (Mrina) on August 26, 2021

I often find myself looking up commands or forgetting what I did for a simple task. Thought it would be a good opportunity to compile all the Docke...
Collapse
 
jitendra profile image
Jitendra Thakur •

it's really nice cheatsheet.
I would like to add :
docker system prune -a
to delete all the resources which has been created by user.
Note: Do not apply this command in production like environment. it is just for practice purpose.

Collapse
 
mrinasugosh profile image
Mrinalini Sugosh (Mrina) •

Glad it was helpful! Sweet thanks for the suggestion just added it :)

Collapse
 
cordigliere profile image
Cordigliere • • Edited

Great Cheatsheet !!
I would add:
docker rm $(docker ps -a -q)
to delete all stopped containers

Collapse
 
floryn90 profile image
Florin Lungu •

It's wrong this command since it will remove all containers (running and stopped containers)!
docker ps -a -q will show you all containers into short syntax and docker rm will remove them!
The right syntax should be docker rm $(docker ps --filter status=exited -q) to remove all stopped containers

Collapse
 
cordigliere profile image
Cordigliere •

No you have to use -f (force) to remove also running containers

Collapse
 
mrinasugosh profile image
Mrinalini Sugosh (Mrina) •

Thanks for the contribution! Just added it :)

Collapse
 
rkyadav profile image
Ram •

Thank You for sharing

Collapse
 
mrinasugosh profile image
Mrinalini Sugosh (Mrina) •

Glad it was useful!

Collapse
 
ted_lee_2697 profile image
Ted Lee •

Thanks for sharing!

Collapse
 
mrinasugosh profile image
Mrinalini Sugosh (Mrina) •

Glad it was useful!

Collapse
 
swatirajan7 profile image
Swati Rajan • • Edited

Thanks for sharing...will you be making one for Kubernetes as well?

Collapse
 
mrinasugosh profile image
Mrinalini Sugosh (Mrina) •

Glad you found it useful. Great idea! I can certainly start on one :)

Collapse
 
speni profile image
spenis •

Thank you for the post, much appreciated!

Collapse
 
mrinasugosh profile image
Mrinalini Sugosh (Mrina) •

So glad it was helpful!

Collapse
 
vajracool profile image
VajraCool •

Thank you for sharing , this would help many for sure.

Collapse
 
mrinasugosh profile image
Mrinalini Sugosh (Mrina) •

Awesome so glad it was helpful!