using option --digitalocean-ssh-key-fingerprint with docker-machine

April 30, 2018 1.4k views
Docker Ubuntu 16.04

On Windows 10, I followed the instructions here to create a swarm, and it worked OK.
Now I want to be able to connect to each node in the swarm using one of the SSH keys that I have in DO. To try this, I used command:

docker-machine create --driver digitalocean --digitalocean-ssh-key-fingerprint mFingerprint --digitalocean-access-token mToken mNodeName

the command ends up with an error “Error creating machine: Error detecting OS: OS type not recognized”. The droplet is created and I can access it with the ssh key that I wanted to use, but docker is not installed in the droplet.
I think that the problem is that docker-machine does not have the ssh key so it cannot connect to the droplet once created.

How should I proceed, in Windows or Linux, to create nodes for the docker swarm to which I can connect using the stored SSH key?

1 Answer

If you check the cloud-init-output.log and your access log are you able to see docker-machine’s attempts to access the server?

  • In the ssh access log of the droplet there are multiple lines like

    3 13:38:46 node-1 sshd[1849]: Connection closed by port 42444 [preauth]

    The thing is that “docker-machine ssh” in my Windows PC cannot connect because if does not know the path to the private key. Inside the config.json file that docker-machine creates for this machine, I can see

    “SSHKeyPath”: “”,

    Digitial Ocean’s driver does not seem to have a way to specify this path , like other drivers do. Or does it?

Have another answer? Share your knowledge.