DEV Community

Docker commands I can't live without

Allen Reinmeyer on August 13, 2019

This post originally appeared on areinmeyer.dev I have used Docker since late 2015 when I started our greenfield React/NodeJS project. Like many ...
Collapse
 
pabloc profile image
PabloC

Great article.
To remove unused images, we can use "docker system prune", i guess.

Collapse
 
areinmeyer profile image
Allen Reinmeyer

Thanks! I think in a previous version, prune was more aggressive in deleting unused images and not just dangling ones. But looking at the documentation, it's doing the same thing as I noted by default now. I have it aliased in my .zshrc as ddclean, so I'll have to update it. That's way easier to remember than what I'm using if I'm not on my machine! :D

Collapse
 
areinmeyer profile image
Allen Reinmeyer

Actually I just tried docker system prune. It warns:

docker system prune
WARNING! This will remove:
  - all stopped containers
  - all networks not used by at least one container
  - all dangling images
  - all dangling build cache

The similar command would be docker image prune which just removes the dangling images. I mixed the 2 separate commands together in my above comment. System prune is more aggressive and "nuclear". But also useful!