Execute an interactive bash shell on the container
docker exec -it app-accounting bash
Remove unused volumes
$ docker volume rm (docker volume ls -q -f dangling=true)
Remove all images
$ docker rm (docker ps -a -q) | docker rmi (docker images -q)
Remove dangling images
$ docker rmi (docker images -q -f dangling=true)
Remove images with name set as NONE
$ docker rmi (docker images -a | grep "^<none>" | awk \'{print $3}\')
Shows how much space all your images, containers and volumes are using
$ docker system df
Reclaim some disk space
$ docker system prune
Basic command
$ docker run -i -t -rm kyan/rails:ruby2.4 /bin/bash # run a container and delete when closed
Deleting all the containers
Before deleting the volumes, you need to delete all the existing containers using the following command (make sure the application is not running)
$ docker rm $(docker ps -a -q) -f
Deleting all the volumes
Once all the containers are deleted, you can delete all the Docker volumes on your computer using the following command
$ docker volume prune
If you don't want to delete all the Docker volumes on your computer, you can search for a specific one and deleting it
$ docker volume ls
$ docker volume rm <name_of_volume>
Recreating the volumes
Recreating the volumes is as simple as restarting the application
$ docker-compose up --build