What is the best alternative for docker-machine with digitalocean droplets

Viewed 435

I've been using docker-machine for creating and connecting to digitalocean droplets. In August 2021 it is deprecated and with the latest MacOs Monterey, I started to get more errors. I can find some ways to work it out, but I don't want to spend more time to a deprecated library.

Docker-machine was really helpful at creating digital ocean droplets. Writing a one line of code was creating the droplet, installing docker to the remote droplet, configuring local certs and machine folders.

docker-machine create --driver digitalocean --digitalocean-image ubuntu-20-04-x64 --digitalocean-size "s-2vcpu-2gb" --digitalocean-region=lon1 --digitalocean-access-token <acces-token> droplet-name

A couple of months ago I started adding this bit otherwise, it was not able to create the droplet.

--engine-install-url "https://releases.rancher.com/install-docker/19.03.14.sh"

After creating the droplet connecting it is as easy as eval $(docker-machine env droplet-name)

I would really like to know what are other alternatives people use. According to digitalocean it requires a bunch of steps

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04

There should be some other ways that I can create and connect to remote droplets. Please share any methods you are using for docker operations on remotes hosts.

1 Answers

I came up with using docker context is the easiest solution for who are using docker-machine. I couldn't manage to run docker-machine after upgrading my operating system to macOS Monterey

Closest docker-machine experience is creating a context with

docker context create remote --docker “host=ssh://user@remotemachine”

The remote host is named as 'remote' here.

You can switch between hosts by using docker context use remote

The best part of using docker-machine or docker context is, I don't need to copy my docker-compose files to remote. It provides local terminal experience which is very helpful when there are multiple hosts to deploy.

For more information, you can see the official documentation below

https://www.docker.com/blog/how-to-deploy-on-remote-docker-hosts-with-docker-compose/

Related