docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
Removing All Unused Docker Objects (https://linuxize.com/post/how-to-remove-docker-images-containers-volumes-and-networks/)
The docker system prune command removes all stopped containers, dangling images, and unused networks:
docker system prune
This command will prompt you to confirm the operation:
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N]
Use the -f
or --force
option to bypass the prompt.
By default, the command doesn’t remove unused volumes to prevent losing important data. To remove all unused volumes, pass the --volumes
option:
docker system prune --volumes
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all volumes not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] y
docker-compose ps
docker-compose restart elasticsearch