Skip to content

Reference (Docker)

Jason Wang edited this page Oct 5, 2022 · 9 revisions

Terminology

  • image: a file representing an OS
  • container: a running instance of an image

Basic docker commands

docker system prune # Clean everything

# Images
docker system prune --all # Delete all docker images
docker pull <docker image name> # Pull a docker image
docker tag old_image_name new_image_name
docker image ls # list all of the docker images that are built
docker run -it <docker image id> bash # Start a docker image as a container

# Containers
docker ps # list all of the docker containers that are running
docker rm $(docker ps -aq) # Remove all not running docker containers
docker stop $(docker ps -aq) # Stop all not running docker containers
docker exec -it <docker image id> bash # SSH into a docker image to see whats going on inside it

# Docker compose
docker-compose build # Build all docker images
docker-compose pull # Takes images from dockerhub
docker-compose push # Push all docker
docker-compose up # Start the containers specified in this file