Docker Community Forums

Share and learn in the Docker community.

Docker 1.12.0 Swarm Run on Specific Node


(Mastermindg) #1

I’ve got Docker 1.12.0 installed on all of my nodes. I like the fact that swarm is integrated now. I built the swarm with one command per node. Now I’ve got a swarm with 5 workers and 2 managers. I’d like to run some services on the workers but am lost on how to do that. Here’s what I’ve got so far:

docker swarm init — create swarm
docker swarm join — join swarm
docker node ls — lists nodes
docker node ps $node — show running containers on a node ??
docker run – runs on the master

Here’s where I’m lost:

docker run --name some-nginx -v /devel/nginx:/user/share/nginx/html:ro -d -e constraint:node==pi1 nginx

I would assume that the above command would run nginx on pi1…unless it couldn’t in which case it would error out ??. Howerver, all this command does is run it on the master.

How can I start a container on a worker node with the “new” Docker swarm?


(Mastermindg) #2

So after some snooping I found out about docker service. I can run:

docker service create --name proxy -p 80:80 --network proxy_network nginx

Now I’ve got running containers on my managers. Interestingly my managers are 64-bit while my workers are armv7.

How can I constrain a service to just run on arm?


(Mastermindg) #3

So super excited about this new Docker engine!!!

docker node update --label-add ostype=pi pi1
docker node update --label-add ostype=pi pi2
docker node update --label-add ostype=pi pi3
docker service create --name selenfox --constraint ‘node.labels.ostype == pi’ mastermindg/rpi-selenium-firefox
docker service scale selenfox=3

Now I’ve got a bunch of running containers across my swarm.


Run a docker service on a swarm having several system architectures
(Nathan Le Claire) #4

Good on you for following up to post the solution. I was going to suggest docker service create --constraint but I’m 5 days too late XD


(Mgrybyk) #5

Hi,
I’ve initiated swarm like the first post says.
Next what I’m trying to do is to manage it.
docker -H :2377 info
(or anything else like start container)
but i cant, it says: Are you trying to connect to a TLS-enabled daemon without TLS?
how can I disable tls or make it work. Thank you


(Nathan Le Claire) #6

@mgrybyk You don’t connect to :2377 on Docker API.

You swarm init on one node (manager) and then swarm join from the other (worker) nodes.

Then, on manager node, create services with docker service create