2 ms·
This is probably a good starting point: https://docs.docker.com/engine/swarm/swarm-tutorial/ https://docs.docker.com/engine/swarm/swarm-tutorial/ Essentially,
by KronisLV 5y ago
This is probably a good starting point: https://docs.docker.com/engine/swarm/swarm-tutorial/ https://docs.docker.com/engine/swarm/swarm-tutorial/
Essentially, if you already have a node or multiple nodes that have Docker, you can initialize a swarm with:
docker swarm init --advertise-addr <MANAGER-IP>
And, optionally, add nodes as workers to the cluster:
docker swarm join --token <JOIN-TOKEN> <MANAGER-IP>:2377
And then you can deploy stacks:
docker stack deploy --compose-file docker-compose.yml my_stack
Here's a tutorial about stacks: https://docs.docker.com/engine/swarm/stack-deploy/ https://docs.docker.com/engine/swarm/stack-deploy/
You'll probably want to read up on the Compose specification and the values that Docker Swarm and Docker Compose support since last i checked there were some differences in v2 / v3 (which many people still use): https://docs.docker.com/compose/compose-file/ https://docs.docker.com/compose/compose-file/
Of course, if you want a less steep learning curve for actually running Swarm, depending on your personal preferences (GUI vs CLI), you might want to have a look at Portainer, which is a lovely and simple dashboard: https://www.portainer.io/ https://www.portainer.io/
From there, it should mostly be a matter of running multiple replicas of each of your services and doing rolling updates, while having a stable load balancer in front of everything: https://docs.docker.com/compose/compose-file/compose-file-v3/#update_config https://docs.docker.com/compose/compose-file/compose-file-v3...
Also, you'll probably want health checks because Swarm can then route traffic to containers only after they have truly started: https://docs.docker.com/compose/compose-file/compose-file-v3/#healthcheck https://docs.docker.com/compose/compose-file/compose-file-v3...