Docker
Created: June 7, 2018 / Updated: July 24, 2025 / Status: in progress / 2 min read (~358 words)
- Run a swarm example on multiple machines/VMs
- Image: An executable package (code, runtime, libraries, etc.)
- Container: An runtime instance of an image
- Repository: Collection of images
- Registry: Collection of repositories
- Task: A single container running in a service
-
Stack: A group of interrelated services that share dependencies
- docker swarm init
docker
docker container --help
docker --version
docker version
docker info
docker run hello-world
docker image ls
docker container ls
docker container ls --all
docker container ls -aq
docker build -t friendlyhello . # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyhello # Run "friendlyname" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyhello # Same thing, but in detached mode
docker container ls # List all running containers
docker container ls -a # List all containers, even those not running
docker container stop
docker container kill
docker container rm
docker container rm $(docker container ls -a -q) # Remove all containers docker image ls -a # List all images on this machine docker image rm
docker login # Log in this CLI session using your Docker credentials
docker tag
docker push username/repository:tag # Upload tagged image to registry
docker run username/repository:tag # Run image from a registry
docker stack ls # List stacks or apps
docker stack deploy -c
docker service ls # List running services associated with an app
docker service ps
docker inspect
docker container ls -q # List container IDs
docker stack rm
docker swarm leave --force # Take down a single node swarm from the manager