Selected topic
Container Orchestration
Prefer practical output? Use related tools below while reading.
Docker Swarm is a container orchestration tool provided by Docker that allows you to deploy and manage multiple containers across a cluster of machines. It's designed to scale your applications easily, efficiently, and reliably.
dockerfile
FROM nginx:latestCOPY index.html /usr/share/nginx/html/
EXPOSE 80
index.html file inside.bash
docker build -t my-web-app .
docker tag my-web-app:latest <username>/my-web-app:latest
docker push <username>/my-web-app:latestdocker-compose.yml file for the service definitionyml
version: '3'
services:
web:
image: <username>/my-web-app:latest
ports:
- "80:80"docker-compose.yml file defines a single service called web that uses our custom Docker image.bash
docker swarm init
docker swarm join --token <join-token> <manager-node-ip>bash
docker stack deploy -c docker-compose.yml my-web-app-stackweb service to the Swarm cluster. You can verify that the containers are running by checking the Swarm logs:bash
docker ps -a --format "table {{.Names}}"bash
docker service scale my-web-app-stack_web=3web service.That's a basic overview of deploying an application with Docker Swarm!