on OSX generic driver keep asking the ssh key passphrase
The generic driver is unusable with OSX if you have a passphrase protecting your key. It keeps asking for the passphrase and the output of ssh trying to add the key to the keyring confuses docker-machine.
After several attempt to find the issue I finally found this report:
http://apple.stackexchange.com/a/26252/96741
It looks like that OSX keychain doesn't like to have a rsa key without the corresponding .pub file
Executing the following command, while waiting for the input of the passphrase, fixes the issue:
ssh-keygen -y -f $HOME/.docker/machine/machines/$MACHINE_NAME/id_rsa > $HOME/.docker/machine/machines/$MACHINE_NAME/id_rsa.pub
The easiest fix here is to generate that file while importing the key.
This happens on both, OSX and Linux. I tried on both .. on both keep asking for password, even if I don't want.
I tried your solution as well, but I got this as a response: load failed
+1
Thanks mnencia, that worked for me.
@mnencia @marlonpp Have you created the machine with or without --generic-ssh-key. If you do without, then docker-machine will rely on identities in ssh-agent and that should do the job.
I have my passphrase of the key (~/.ssh/id_rsa) in my OSX Keychain. The generic driver copies this key to the docker machine config folder and then ssh asks for the passphrase again. It seems that Keychain stores the passphrase together with the key file location. If the file is copied it asks again. But two days ago, there was a commit 8524a4e that enables BatchMode for ssh and ssh won't never ask for the passphrase of the key copy. This makes the generic driver broken on OSX (at least for keys with passphrase).
Why does the generic driver copies the key at all? Some people may have stored the key on an external flash storage and don't want it copied somewhere they are not aware of.
@benediktarnold Have you tried using the ssh-agent?
Here's what the generic driver says:
Interaction with SSH Agents
When an SSH identity is not provided (with the --generic-ssh-key flag), the SSH agent (if running) will be consulted. This makes it possible to easily use password-protected SSH keys.
Note that this usage is only supported if you're using the external SSH client, which is the default behaviour when the ssh binary is available. If you're using the native client (with --native-ssh), using the SSH agent is not yet supported.
Closing. Support of passphrase protected ssh keys in the generic driver involves using the ssh-agent.