Docker Community Forums

Share and learn in the Docker community.

Can not login docker swarm master via SSH in MacOS

I came across with a problem that login docker machine, and I post the question in stackoverflow and no one could help me yet, the question address is:

In brief:

  • I create a swarm-master, swarm-agent-00 (swarm node) by docker-machine cmd with no problem
  • MacOs shut down because of out of memory, and I restart it
  • I create another swarm node (swarm-agent-01), it worked well
  • I start swarm master, but it exit at the ssh login step
  • I test the two node, they could start well

Then I trace the start process with docker-machine -D, and found it can not login by SSH with docker user:

ssh -i .../swarm-master/id_rsa -p 52348 -o PasswordAuthentication=no docker@

It failed, after googled, I found it can login by password, which is tcuser, and then I login machine and found there was no .ssh folder in /home/docker (the other two node had).

So I create the .ssh folder and copied id_rsa in local into it and named it authenticated_key, by run the following cmd, swarm-master had running:

docker-machine regenerate-certs swarm-master
eval "$(docker-machine env swarm-master)"

Since I thought the problem solved, and I restart swarm-master machine, it failed at ssh login step again. By viewing the machine, I found .ssh folder is missing, no matter how many time I try, .ssh folder still cannot find every time I restart machine.

Can someone help me how to solve the problem?