Skip to content

Instantly share code, notes, and snippets.

@lucj
Created March 14, 2017 08:29
Show Gist options
  • Save lucj/c2432f38b887f9e8c9b32ec1f0854281 to your computer and use it in GitHub Desktop.
Save lucj/c2432f38b887f9e8c9b32ec1f0854281 to your computer and use it in GitHub Desktop.
Swarm creation
# ON NODE1
docker@node1:~$ docker swarm init
Error response from daemon: could not choose an IP address to advertise since this system has multiple addresses on different interfaces
(10.0.2.15 on eth0 and 192.168.99.100 on eth1) - specify one with --advertise-addr
# Let's go with eth1 to use the 192.168.99.100 IP
docker@node1:~$ docker swarm init --advertise-addr eth1
Swarm initialized: current node (jnrkaduxwe31imlpps068234f) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-5nht70k8qeweahbyrmsgyz53lnoxr2irj9ai1eq8sdcskwmz8q-9ndkvaxdqm8ujgt2enyrf3q56 \
192.168.99.100:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
# Get the token to add a manager (the command in the output will be ran on node3 later on)
docker@node1:~$ docker swarm join-token manager
To add a manager to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-5nht70k8qeweahbyrmsgyz53lnoxr2irj9ai1eq8sdcskwmz8q-4ouo16ph2ld5c471ta3hhsrgt \
192.168.99.100:2377
# ON NODE 2
Docker version 17.03.0-ce, build 3a232c8
docker@node2:~$ docker swarm join \
> --token SWMTKN-1-5nht70k8qeweahbyrmsgyz53lnoxr2irj9ai1eq8sdcskwmz8q-9ndkvaxdqm8ujgt2enyrf3q56 \
> 192.168.99.100:2377
This node joined a swarm as a worker.
# ON NODE3
Docker version 17.03.0-ce, build 3a232c8
# Run the command provided when issuing "docker swarm join-token manager" on node1
docker@node3:~$ docker swarm join \
> --token SWMTKN-1-5nht70k8qeweahbyrmsgyz53lnoxr2irj9ai1eq8sdcskwmz8q-4ouo16ph2ld5c471ta3hhsrgt \
> 192.168.99.100:2377
This node joined a swarm as a manager.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment