docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.63k stars 1.97k forks source link

Generic driver throws error at copying SSH key #3661

Open thasmo opened 8 years ago

thasmo commented 8 years ago

I'm using docker-machine.exe version 0.8.0, build b85aac1 running on Windows 10 64-bit. When executing docker-machine create --driver generic --generic-ip-address=IP --generic-ssh-key "C:\Users\thasmo\.ssh\id_rsa" my-server I get this error:

Error creating machine: Error in driver during machine creation: unable to copy ssh key: open C:\Users\thasmo\.docker\machine\machines\my-server\C:\Users\thasmo\.ssh\id_rsa: Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch.

To solve it I had to manually copy my id_rsa and id_rsa.pub files to C:\Users\thasmo\.docker\machine\machines\my-server and edit the config.json file within the directory to set the Driver.SSHKeyPath option to the path of the newly copied SSH key.

After that I ran docker-machine regernerated-certs my-server which successfully added my-server as a docker-machine host.

festum commented 8 years ago

@thasmo What did you filled in SSHKey? I can't get it works.

Yogu commented 8 years ago

Same issue here. It's a windows problem, by replacing the \s in your path by /s it works. Strange, as the line in question seems correct and path.base should respect the OS directory separator.

vahric commented 8 years ago

for confirmation , after replace all slashes its worked

C:\Users\vahric>docker-machine create --driver generic --generic-ip-address=10.111.21.164 --generic-ssh-user=noroot --generic-ssh-key="C:/Users/vahric/.ssh/id_rsa" DT1

FYI --> Server Version: 1.12.3

altano commented 5 years ago

I just hit this 2-year-old bug. Forward slashes worked for me too.

Would be nice to fix this in docker-machine itself so that things just work on Windows if anyone can do that.

Thanks for the workaround!