Important commands in Docker that you should know

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.

Like what you read? Give José Castro a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.