Context #
Learned in this study #
Things to explore #
- Run a swarm example on multiple machines/VMs
Overview #
Notes #
-
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
Cheat sheet #
List Docker CLI commands #
docker docker container –help
Display Docker version and info #
docker –version docker version docker info
Execute Docker image #
docker run hello-world
List Docker images #
docker image ls
List Docker containers (running, all, all in quiet mode) #
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 stack ls # List stacks or apps
docker stack deploy -c