16

I have a docker swarm all hosted on AWS, created basically along the lines of this tutorial.

To deploy our code, I need to be able to access this swarm separate of the computer where I created these instances. I don't see anywhere in the docs for the docker-machine amazonec2 driver where I can use my AWS credentials to connect to these existing instances.

Some tutorials I came across use a --url argument to specify via the docker-machine url to connect to an existing instance, but I don't see that argument in my most recent docker-machine version.

Other tutorials mention TLS configuration and using that in conjunction with docker-machine to connect to existing instances, but given unique/secret AWS credentials, this seems redundant and adds a layer of complexity I hope I can avoid.

What is the recommended approach to this?

Unable to connect:

puttygen my-key.pem -L > id_rsa

docker-machine create --driver generic --generic-ip-address=ec2-....compute.amazonaws.com --generic-ssh-key id_rsa Swarm-Dev01

Running pre-create checks... Creating machine... (Swarm-Dev01) Importing SSH key... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available...

Ranch
  • 875
  • 3
  • 8
  • 13
kand
  • 2,268
  • 6
  • 31
  • 43
  • 1
    Maybe you are referencing to a [docker machine generic driver](https://docs.docker.com/machine/drivers/generic/) With generic driver you are able to provision existing remote docker installation and setup it with TLS. – Vaidas Lungis Jan 18 '16 at 17:46
  • @kand did you end up figuring this out? I've been trying myself and I cannot yet determine the correct SSH settings – MrJD Mar 06 '16 at 22:15
  • 1
    I gave up on this and haven't worked on it since :/ – kand Mar 09 '16 at 21:29

1 Answers1

10

To get access to an existing instance, you can use the docker-machine create --driver generic command. The command will ssh onto the machine, make sure docker is installed, and then download certificates that it stores for future access e.g. using docker-compose.

Command:

docker-machine create \
    --driver generic \
    --generic-ip-address=<your_ip> \
    --generic-ssh-key ~/.ssh/id_rsa \
    vm

Documentation: https://docs.docker.com/machine/drivers/generic/

markus-hinsche
  • 1,372
  • 15
  • 26