Adding Existing Digital Ocean Droplet To Docker-Machine

Let’s make this entire process less cumbersome and somewhat less painful.

Rajat Saxena
Nov 23, 2018 · 2 min read

Step 1:

Install the latestdocker-machine using this document.

Step 2:

Log into your DigitalOcean (from now on, DO) dashboard and navigate to your droplet. Then open its console.

Afterwards, change the following setting to yes in /etc/ssh/sshd_config so that you can ssh into your droplet using a plain text password, from your local machine.

Do not forget to revert this setting after you are done setting up the docker-machine.

Step 3:

Log into your droplet from local machine using ssh and add the contents of your local machine’s file (default location is ~/.ssh/ to the ~/.ssh/authorized_keys file on the droplet.

This step will enable password-less ssh to your droplet from your local machine.

Now you can revert the setting from step 2.

Step #4:

Create a generic docker machine using the following command.

docker-machine create \
  --driver generic \
  --generic-ip-address=<DROPLET_IP_ADDR> \
  --generic-ssh-user root \
  --generic-ssh-key ~/.ssh/id_rsa \

The above command will generate some configuration files and you must be all set post this step.

Once the droplet is configured to be used with docker-machine, you can issue your regular docker-machine commands, like the following:

# ssh to your dropletdocker-machine ssh <MACHINE_NAME>

Hopefully this post might have alleviated some of your docker-machine woes.

Don’t forget to give this post a thumbs up if it was useful. Till next time.

Rayn Studios

App Development & Coaching

Rajat Saxena

Written by

Developer, Entrepreneur & Founder of Rayn Studios

Rayn Studios

App Development & Coaching