Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc with the use of swarm binary instead of docker run swarm ? #1245

Closed
nsteinmetz opened this Issue Sep 28, 2015 · 7 comments

Comments

Projects
None yet
3 participants
@nsteinmetz
Copy link

nsteinmetz commented Sep 28, 2015

Hi,

I would like to use docker on arm infrastructure ; thus I cannot use the swarm image as is. So I decided to compiled swarm on my cubietruck / raspberry.

On this issue #797, it is said it's better to run swarm binary directly than a daemon docker. As mentionned in the doc [1], it says 'just replace docker run swarm by swarm".

I'm not sure on how it should be done and what is part of the docker command and what can be used for swarm command.

By any chance, are the some documents from which I could start ?

Thanks,
Nicolas

[1] https://github.com/docker/swarm/#clone-and-build-swarm

cc @chanwit

@chanwit

This comment has been minimized.

Copy link
Contributor

chanwit commented Sep 29, 2015

@nsteinmetz docker run swarm is actually run the swarm binary pulled from the official repository. This swarm is compiled for x86-64 bit arch.

In our case that we are trying to run swarm on different archs, we need to compile our own binary of swarm. That's the reason that the doc is mentioned to replace docker run swarm (official 64-bit) to swarm (a custom binary that we must compile it ourselves).

@nsteinmetz

This comment has been minimized.

Copy link
Author

nsteinmetz commented Sep 29, 2015

Thanks @chanwit,

It's a little bit clearer but I think I'm not clear yet with the process. Maybe there is or I imagine too much inception there.

So far, I have 2 cubietrucks and 1 raspberri with docker 1.8.2 installed on all of them. Swarm is also compiled on each of them (not in a container)

What I did so far without success relying on [1] :

  • On my Rasp :
    • Add the -H tcp://0.0.0.0:2375 option to the docker service
    • Do a swarm create to get a tocken
  • On my cubies
    • Do a swarm join ...

But seems it failed ; I don't have the log with me now to provde more details. I'm also sceptical about the swarm binary. Should it be run as a daemon to some extend or is it just a one time command thant interact with the docker daemon and then the latter will keep the information and do some stuff ?

An alternative question could be : could I use the docker-machine doc [2] but is it possible in an ARM context? I thought it was not as the --swarm* options would havec fetched the 64 bits swarm image.

[1] https://docs.docker.com/swarm/install-manual/
[2] https://docs.docker.com/swarm/install-w-machine/

@nsteinmetz

This comment has been minimized.

Copy link
Author

nsteinmetz commented Sep 29, 2015

Thinking about it during my computation to office and re-reading the docs, shouldn't it be more:

  • Each docker daemon listen to tcp://0.0.0.0:2375
  • From each node, do a
swarm join --addr=<node_ip:2375> token://<cluster_id>
  • Then promote a node as a master

I think I confused the notion of daemon with the notion of master and so when I was doing the swarm join, I was trying to join the supposed to be master-node.

Will try it tonight at home.

@MHBauer

This comment has been minimized.

Copy link
Member

MHBauer commented Sep 29, 2015

@nsteinmetz that looks good. To reinforce, each node needs to have the docker daemon running on it. Then each node needs to run swarm join. Then the manager/master needs to be started somewhere, either on a node or even a remote computer, as long as it has network connectivity to all nodes.

@nsteinmetz

This comment has been minimized.

Copy link
Author

nsteinmetz commented Sep 29, 2015

Thanks @MHBauer for the confirmation.

I did it as at the end, I can do:

swarm l token://03ac974de5db2791b4c3cfe89c307655
192.168.8.101:2375
192.168.8.100:2375
192.168.8.102:2375

But I cannot find the way to manage my cluster:

swarm m token://03ac974de5db2791b4c3cfe89c307655
INFO[0000] Listening for HTTP                            addr=127.0.0.1:2375 proto=tcp
FATA[0000] listen tcp 127.0.0.1:2375: bind: address already in use: is Docker already running on this machine? Try using a different port

However, I could do it remotely with:

docker run -d -p 2375:2375 swarm manage token://03ac974de5db2791b4c3cfe89c307655
docker -H tcp://laptop_ip:2375 info
Containers: 0
Images: 0
Role: primary
Strategy: spread
Filters: affinity, health, constraint, port, dependency
Nodes: 3
 black-pearl: 192.168.8.102:2375
  └ Containers: 0
  └ Reserved CPUs: 0 / 1
  └ Reserved Memory: 0 B / 456 MiB
  └ Labels: executiondriver=native-0.2, kernelversion=3.18.11-hypriotos+, operatingsystem=Raspbian GNU/Linux 7 (wheezy), storagedriver=overlay
 or-azur: 192.168.8.101:2375
  └ Containers: 0
  └ Reserved CPUs: 0 / 2
  └ Reserved Memory: 0 B / 2.067 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=4.2.0-sunxi, operatingsystem=Debian GNU/Linux 8 (jessie), storagedriver=overlay
 thanos: 192.168.8.100:2375
  └ Containers: 0
  └ Reserved CPUs: 0 / 2
  └ Reserved Memory: 0 B / 2.065 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=4.2.0-sunxi, operatingsystem=Debian GNU/Linux 8 (jessie), storagedriver=overlay
CPUs: 5
Total Memory: 4.577 GiB
Name: 34c3456e0cb9

So is there a way to manage from a node using the swarm binary ?

@MHBauer

This comment has been minimized.

Copy link
Member

MHBauer commented Sep 29, 2015

swarm manage takes a --host -H parameter like docker daemon. Give it a different port to listen on, as you already have the daemon listening on 2375.

@nsteinmetz

This comment has been minimized.

Copy link
Author

nsteinmetz commented Sep 29, 2015

Indded @MHBauer, thanks. I thought first that host would only accept an IP.

But this would work:

swarm m -H 192.168.8.100:2345 token://03ac974de5db2791b4c3cfe89c307655
INFO[0000] Listening for HTTP                            addr=192.168.8.100:2345 proto=tcp
INFO[0001] Registered Engine or-azur at 192.168.8.101:2375 
INFO[0001] Registered Engine thanos at 192.168.8.100:2375 
INFO[0004] Registered Engine black-pearl at 192.168.8.102:2375 

And then:

 docker -H tcp://192.168.8.100:2345 info
Containers: 0
Images: 0
Role: primary
Strategy: spread
Filters: affinity, health, constraint, port, dependency
Nodes: 3
 black-pearl: 192.168.8.102:2375
  └ Containers: 0
  └ Reserved CPUs: 0 / 1
  └ Reserved Memory: 0 B / 456 MiB
  └ Labels: executiondriver=native-0.2, kernelversion=3.18.11-hypriotos+, operatingsystem=Raspbian GNU/Linux 7 (wheezy), storagedriver=overlay
 or-azur: 192.168.8.101:2375
  └ Containers: 0
  └ Reserved CPUs: 0 / 2
  └ Reserved Memory: 0 B / 2.067 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=4.2.0-sunxi, operatingsystem=Debian GNU/Linux 8 (jessie), storagedriver=overlay
 thanos: 192.168.8.100:2375
  └ Containers: 0
  └ Reserved CPUs: 0 / 2
  └ Reserved Memory: 0 B / 2.065 GiB
  └ Labels: executiondriver=native-0.2, kernelversion=4.2.0-sunxi, operatingsystem=Debian GNU/Linux 8 (jessie), storagedriver=overlay
CPUs: 5
Total Memory: 4.577 GiB
Name: thanos

Hopefully it may be useful for someone else ; just need to make it run by supervisor so that I don't have to run it manually.

I think I have everything I need now ; a huge thanks to @chanwit and @MHBauer to show me the way :)

@nsteinmetz nsteinmetz closed this Sep 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.