Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to replace the default ssh key to get access to docker-machine

I am using docker-machine to create a develop environment. I want to change the docker-machine default ssh key.

I check the config of my new machine:

docker-machine config develop
--tlsverify --tlscacert="/Users/robe/.docker/machine/machines/develop/ca.pem" --tlscert="/Users/robe/.docker/machine/machines/develop/cert.pem" --tlskey="/Users/robe/.docker/machine/machines/develop/key.pem" -H=tcp://192.168.99.103:2376

when I try to access using the key:

--tlskey="/Users/robe/.docker/machine/machines/develop/key.pem"

With this command:

ssh -i /Users/robe/.docker/machine/machines/develop/key.pem [email protected]

Then I got the prompt to write password. So Why I can't access to my virtual machine using this access key.

  • Do I need to do any other configuration?
  • Is possible to specify a new key?
  • What is the docker user password to get access using ssh key connection?

Any help please?

like image 373
Robert Avatar asked Aug 24 '15 18:08

Robert


1 Answers

The key you're attempting to use is an SSL key used to protect the SSL connection to the remote docker agent. It is not an SSH key (different format).

SSH keys are generated for each machine created. Try the following command to obtain ssh access:

docker-machine ssh development 

A more convoluted solution would be:

ssh -i ~/.docker/machine/machines/development/id_rsa docker@$(docker-machine ip development) 
like image 168
Mark O'Connor Avatar answered Sep 24 '22 19:09

Mark O'Connor