Important commands in Docker that you should know

José Castro
Devsys
Published in
1 min readAug 15, 2017

Recently we have some troubles with a machine running Docker with some services, Yep it’s a production machine using Docker, but there’s no problem, it’s a stateless service. The trouble was we can’t create more versions of the services (disk space), for now we have the creation and deploy as an automated task, but the destroy o cleaning task, not (yet).

Beware of the use of this commands, they made irreversibles changes.

# Remove all containers
docker rm $(docker ps -a -q)
# Remove all images
docker rmi $(docker images -q)
# Remove all images, also with linked containers
docker rmi $(docker images -q) --force
# Remove unused data
docker system prune

Use it wisely.

--

--