Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rabbitcannon/1737322ea4a6b602e61a29ed689e04ca to your computer and use it in GitHub Desktop.

Select an option

Save rabbitcannon/1737322ea4a6b602e61a29ed689e04ca to your computer and use it in GitHub Desktop.
Kill all container, remove all images and stop all containers
### You need to kill docker on mac because it's erroring and won't go away?
killall Docker
#stop all containers:
docker kill $(docker ps -q)
#remove all containers
docker rm $(docker ps -a -q)
#kill and remove all containers
docker kill $(docker ps -q) && docker rm $(docker ps -a -q)
docker system prune -a -f --volumes
#remove all docker images
docker rmi $(docker images -q)
#build image without cache
docker build --no-cache
# Docker down and remove volumes
docker-compose down -v
# Rebuild image without cache
docker-compose build --no-cache
# docker destroy,....everything(except your volumes)!
docker system prune -a
# docker reclaim space on volumes
docker volume prune
# get docker container IPs
docker inspect CONTAINER_NAME --format '{{ .NetworkSettings.IPAddress }}'
# SSH onto container
docker exec -it CONTAINER_NAME bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment