Skip to content

Instantly share code, notes, and snippets.

@wisniewski94
Last active December 10, 2019 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wisniewski94/2c00d8d1cb62d56d64df86108adee17c to your computer and use it in GitHub Desktop.
Save wisniewski94/2c00d8d1cb62d56d64df86108adee17c to your computer and use it in GitHub Desktop.
# DOCKER
docker build # Builds Docker images from a Dockerfile
docker run -it <container id> bash # Run bash inside docker container
# CONTAINERS
docker ps -a # List running containers
docker container ls -a # List containers
docker restart <container> # Restart container
docker stop $(docker ps -aq) # Stop all containers
docker rm $(docker ps -a -q) # Remove all containers
#IMAGES
docker image ls -a # List images
docker rmi $(docker images -q) # Remove all images
docker rmi <container> -f # Force image remove
# COMPOSE
docker-compose up -d # Build docker compose file and run it in detach mode
docker-compose up --no-cache # Build docker compose file from scratch every time
docker-compose down # Deletes container and network but not an image
docker-compose build # Rebuild image
docker-compose ps # List running containers created with docker-compose
docker-compose logs <service> # Show container logs
docker-compose exec <service> sh # Run shell inside service
-u <user> # Run as user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment