-
Install latest release of the docker engire. Currently the test were made with 18.09.5 release.
-
Switch Docker into the swarm mode:
docker swarm init --default-addr-poll 10.254.0.0/16
You may specify another address poll, if it overlaps with your organization network.
In order to leave the swarm mode execute the following command.
docker swarm leave --force
-
Configure the routing to the swarm network.
-
You need to know the IP of the host that provides access to the overlay networks:
ip route | grep docker_gwbridge
My output is:
172.18.0.0/16 dev docker_gwbridge proto kernel scope link src 172.18.0.1
The required address is:
172.18.0.1
. -
Add route to the swarm address pool:
sudo route add -net 10.254.0.0/16 gw 172.18.0.1
-
-
Create the stack for the back-end:
docker stack deploy -c service.yaml test_000
This stack consists out of 4 instances of Mariadb 10.3 with users repl, maxuser created.
-
Get the IP-addresses of the back-end.
- Get the id of the stack tasks:
docker stack ps test_000
- Get the IP address from the task:
docker inspect --format '{{range .NetworksAttachments}}{{.Addresses}}{{end}}' TASK_ID
-
Spin-up the MaxScale that will connect to the services:
docker stack deploy -c full-service.yaml test_000
-
Inspect the MaxScale startup log
- Get the id of the service that belong to required task:
docker inspect --format "{{.ServiceID}}" TASK_ID
- Get the logs of the service
docker service logs SERVICE_ID
-
When finished, remove the service stack:
docker stack rm test_000
amvasilyev / docker-swarm-stack-test Goto Github PK
View Code? Open in Web Editor NEWThe tests of setting up the services with Docker Swarm
License: MIT License