Docker logo

After learning how to install Docker on Linux Mint 18 and 18.1 using this article and using this other one for learning how to install Docker Machine on the same distribution, the next logical step is to use that Docker Machine to provision Dockerized hosts, or machines, on supported Cloud platforms.

And that is the subject of this article – How to use Docker Machine to provision Dockerized hosts on a supported Cloud hosting provider. For this article, we’ll be provisioning the servers on the DigitalOcean platform, which offers cheap servers with SSD storage.

For this to work, you’ll need to have a DigitalOcean account. To sign up you may use this link. It’s an affiliate link, so using it to sign up benefits me and this site. You’ll also need to generate a DigitalOcean API token, which will be used for authentication when provisioning a machine. Use this DigitalOcean article to learn how to generate one.

Create a Bash Variable for Your DigitalOcean API Token

The DigitalOcean API token is a long string that can be difficult to work with on the command line. To make things easier, it’s better to assign it to a Bash variable. And the best method of doing that is to add it to the .bashrc file under your home directory. Use the following commands to accomplish that.

Provision One Dockerized Host from Linux Mint 18/18.1

At this point, you may start provisioning machines using the docker-machine command. And we’ll be doing that on the DigitalOcean platform. If you have VirtualBox installed, you can also provision machines locally. The command you need to provision your first machine is given below:

It will take about three minutes, but after that, you’ll have a server on DigitalOcean with the latest Docker Engine installed. And though the last line of the output will tell you how to connect your Docker client to the remote machine, the best method is to employ the docker-machine use command. By default, that machine will be running the latest Ubuntu LTS version, which is Ubuntu 16.04 at the time of this writing. It will also be the smallest DigitalOcean Droplet, with 512 MB of RAM.

Related Post:  So what happens when Linux Mint 18.2 Cinnamon crashes?

You can instruct Docker Machine to use an operating system other than Ubuntu 16.04, and even specify the size of the Droplet, that is, how much RAM it should be allocated.

Provision Multiple Dockerized Host from Linux Mint 18/18.1

Provisioning one Dockerized host is nice, but the command can be extended with a little Bash magic to provision as many as you can afford to pay for. For example, the commands you may use to provision two or more machines are given next.

With those commands, you’ve now seen how you can provision hundreds, even thousands of Dockerized hosts with a single command.

Managing Dockerized Hosts from Linux Mint 18/18.1

With Docker Machine, managing Dockerized hosts is not complicated. In this section, you’ll become familiar with basic commands you’ll need to work with it on Linux Mint 18/18.1. The simplest command you’ll be using regularly is docker-machine ls, which is used to list provisioned machines. The output is given in the following code block.

So how do you activate a machine? By using the following command. Note that when a machine is activated, your Docker client is connected to it, so that all Docker commands (not Docker Machine commands) you type are executed on it.

If you installed Docker Machine using this article, activating a machine will include its name in your command prompt. That makes it easy to keep track of which machine you’re working on when you have multiple machines.

A Dockerized host is just like any other server, so you can log into it using SSH and perform all the administrative tasks you need to. You can also log into it using the docker-machine ssh command. And with a variation of the same command, it’s possible to execute any command on the machine and perform the same administrative tasks without actually logging into it. Below are a few example commands you can execute on a remote machine using the docker-machine ssh command.

Related Post:  How to replace GRUB with BURG on Linux Mint 11

Running Containers on Remote Machines form Linux Mint 18/18.1

The whole point of provisioning a server with Docker Engine installed on it is to be able to run containers on it. As you saw in the previous section, with Docker Machine, you can do that without actually logging into the machine in the traditional way. The following commands show how to run containers on a remote machine using the docker-machine ssh command.

Cleaning Up

After provisioning and test-driving one or more Dockerized hosts, there will come a time when you’ll need to stop and/or destroy them. This last set of commands show how to go about it.

Resources

The foregoing has shown how to provision Dockerized hosts, or machines, on the DigitalOcean platform from your Linux Mint 18 or 18.1 desktop. DigitalOcean is just one of many Cloud platforms supported by Docker Machine out of the box. The complete list of core drivers are available here. In a future article, we’ll show how to perform the same operations on the Vultr Cloud platform.

Panel menu Linux Mint 17.3 Cinnamon

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn

Hola! Did you notice that LinuxBSDos.com no longer runs network ads?  Yep, no more ads from the usual suspects that track you across the Internet.  But since  I still need to pay to keep the site running, feel free to make a small donation by PayPal.

Subscribe for updates. Trust me, no spam!

Mailchimp Signup Form

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event for 2020.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest

On social media
Via my newsletter
Mailchimp Signup Form

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event for 2020.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.
Hacking, pentesting distributions

Linux Distributions for Hacking

Experts use these Linux distributions for hacking, digital forensics, and pentesting.

Categories
Archives

The authors of these books are confirmed to speak during

Algorithm Conference

T-minus AI

Author was the first chairperson of AI for the U.S. Air Force.

The case for killer robots

Author is the Director of the Center for Natural and Artificial Intelligence.

Why greatness cannot be planned

Author works on AI safety as a Senior Research Scientist at Uber AI Labs.

Anastasia Marchenkova

An invitation from Anastasia Marchenkova

Hya, after stints as a quantum researcher at Georgia Tech Quantum Optics & Quantum Telecom Lab, and the University of Maryland Joint Quantum Institute, I’m now working on superconducting qubit quantum processors at Bleximo. I’ll be speaking during Algorithm Conference in Austin, Texas, July 16 – 18, 2020. Meet me there and let’s chat about progress and hype in quantum computing.