Docker Community Forums

Share and learn in the Docker community.

Docker Swarm node get public key

swarm
docker

(Sathishsuresh2000) #1

Hello all,

I have 3 docker swarm nodes (all are joined) . All the three nodes are managers (to run docker service). I am able to create swarm service in any of the nodes. Web Application will run in node1 , database server in node2, and job processing in node3.

When I run job from my application (running in node1), it should run in node3. Jobs are basically short-lived containers (services) .

My requirement is to create short-lived service (execute and quit) from node1 and run in node3.

I tried Jaas, its amazing, but doesn’t meet all of my requirements.

I am running latest version of docker engine (18.06.1-ce) in all the 3nodes.

Docker swarm enables tls (Transport layer Security)when we join the nodes. This I came to know by navigating to swarm directory (/var/lib/docker/swarm) and also inspecting docker node.

docker node inspect node-id lists the details (including trust info) .

Now, I can use docker run command to run short-lived containers. But to run in node3, I need to pass tlscert, tlskey.

docker --tls --tlsverify --tlscacert=/home/gt/ca.pem --tlscert=/home/gt/cert.pem --tlskey=/home/gt/key.pem -H=x.x.x.x:2377 run job-executor

When I run the above command, my public key doesn’t match with the private key.

I got public key, ca , cert from docker node inspect node-id

I am very sure docker swarm also uses these certs to connect to different nodes, since nodes are tls enabled.

Can someone please help me to get construct valid public key file for specific node, or help me with running short-lived swarm services.

I am stucked with this problem for past 3 days, and I tried 100+ refereneces online, nothing worked. I have to deliver in next 2days, so please help me out .