Skip to main content

Useful docker commands

Member for

2 years 2 months
Submitted by admin on

To delete all containers including docker volumes use the following commands in the cli

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

To delete all the images

docker rmi $(docker images -a -q)

Prune all docker images

docker system prune -a

Stop and remove all docker images

docker stop `docker ps --no-trunc -aq` && docker rm `docker ps --no-trunc -aq`

Create a docker MySql database dump

docker exec  /usr/bin/mysqldump -u  --password= > backup.sql

Drop all tables in a docker mySql database dump

docker exec  /usr/bin/mysqldump -u  -p --add-drop-table --no-data  | grep ^DROP | mysql   -u  -p