Docker Community Forums

Share and learn in the Docker community.

SSH To a Node machine in a swarm managed by docker cloud


(Assetmedia) #1

I’ve been bashing my head against this issue for weeks and am almost to a point of just not moving ahead with Docker Swarms on managed by Docker Cloud if I can’t solve this one soon.

I have followed this tutorial to setup a Docker Swarm on AWS using Docker Cloud:

However when I create the swarm through Docker Cloud, I am unable to SSH into one of the Nodes. My manager node needs to house a container running a mongoDB, So I need to SSH into the Manager node to setup and manage the file system for this.

Any attempt to find out how just gets me back to this page: However I have had no luck with this, and I seems to be more related to Docker Nodes being managed in Standard Mode (not swarm Node).

Is anyone able to point me to instructions on how to SSH into a Swarm Node managed by Docker Cloud? Almost at the end of my persistence on this one.



(Sreenivas Makam) #2

1 approach is to ssh to the aws node using the private key and “root” user.
Docker provides a dockercloud proxy container to execute commands against the swarm. The exact command can be found by clicking on the swarm cluster created in dockercloud .For my case, I got:
docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -e DOCKER_HOST dockercloud/client /

(Assetmedia) #3

Thanks Smakam,

I’ve tried doing standard SSH into the AWS server using the private key and “root” user, but for some reason Access is denied if the server is created via Docker Cloud. I can connect fine if I create a standard EC2 instance, but if the EC2 instance is created by Docker Cloud, I cannot SSH into it for some reason. I just assumed it is not possible(?).

Yes, I can connect to Docker Swarm without problem (to run and manage my stack and services etc). I need to be able to access the Node Server so that I can create necassary folders, setup backups etc…

Thanks again.


(Sreenivas Makam) #4

Hi Jason
I tried and I am facing the same issue… Better to open a github issue.
In pre-swarm Docker cloud, we used to deploy authorized keys service to allow ssh. I also tried this now:
docker run -v /home/xxx:/user -e AUTHORIZED_KEYS="cat " dockercloud/authorizedkeys

This also did not not work…

I will try to check with few Docker folks and see.

(Assetmedia) #5

smakam… THANK YOU! At least I know it is not me! I’m new to Docker so this was becoming quite deflating. For now I will just log an issue go back to creating swarms manually… will be good to see what Docker folks you know have to say.

Thanks !

(Sreenivas Makam) #6

Thanks to my fellow Docker captain Luc, he suggested to use “docker” as username when you ssh. That works fine for me. I am pretty sure that will work for you as well. Now, we need to see how to get this into documentation.

(Assetmedia) #7

Smakam, that was it. Just a case of using “docker” to ssh in with. Too Easy !! Thanks a tonne!! Yes, we need to get into the documentation… obvious once known, but no way of knowing really so I am sure a lot of people having same problem. Thanks again. !!

(9845972117) #8

I have been facing the same issue and I am still unable to figure it out. What is the exact command that you use and how to find the node IP/name to ssh into?

(Combinationz) #9

Yeah some other people are having the same problem. And sure would be nice if those who have the solution would document it … like by maybe posting it in a thread on the docker forums that addresses the issue :slight_smile: like this one :slight_smile:

(Scooter4j) #10

Ping. I’d also like a response to the question “What is the exact command that you use and how to find the node IP/name to ssh into?”

(Mcabrams) #11

There may be more than one way to do this, but what I did was find the manager node in EC2 on AWS. Go to instances tab and filter by Tag Keys -> Name, then select the name-of-your-stack-Manager. Once that is selected, in the description find Public DNS (IPv4) entry.

Then you can run

ssh -i ~/path_to_your_appropriate_ssh_key_pair/name_here.pem docker@path-from-public-dns-ipv4-enty