-
-
Notifications
You must be signed in to change notification settings - Fork 9
Reference (Docker)
Jason Wang edited this page Feb 26, 2023
·
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 image ls # list all of the docker images that are built
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 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 stop $(docker ps -aq) # Stop all running docker containers
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
# Identify service with port and kill it
ps -aux | grep <PORT> && sudo kill -9 <PID>
sudo netstat -tulpn | grep <PORT> && sudo kill -9 <PID>
# 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