Skip to content

Instantly share code, notes, and snippets.

@christianb
Last active October 9, 2019 21:24
Show Gist options
  • Save christianb/706b4dcc01e41764b250318fd297c48c to your computer and use it in GitHub Desktop.
Save christianb/706b4dcc01e41764b250318fd297c48c to your computer and use it in GitHub Desktop.
Docker commands
# build with docker compose
docker-compose build
# run with docker-compose and open bash
docker-compose run --rm <image> /bin/bash
# Stop all Docker containers
docker stop $(docker ps -a -q)
# DANGER ZONE
# This will remove:
# - all stopped containers
# - all networks not used by at least one container
# - all dangling images
# - all dangling build cache
docker system prune
# DANGER: Removes all docker containers
docker rm $(docker ps -a -q)
# DANGER: Removes all images, even those images that are referenced in repositories
docker rmi $(docker images -q) --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment