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.

# Use these commands to assign your DigitalOcean API token to a Bash variable
# Open the .bashrc file

nano ~/.bashrc

# Append the next line to the file
# Replace  with the one you generated

export AUTH-TOKEN=

# Assuming the token is db5b297b2th0f5897b09, the actual command would be

export AUTH-TOKEN=db5b297b2th0f5897b09

# Save and close the file
# To activate the changes, type

source ~/.bashrc

# To check that the variable is recognized by the system, type

# The output should be your DigitalOcean API token

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:

# Docker Machine command to create a machine on DigitalOcean
# This command creates a machine called docker-node. You may replace that with your own name

docker-machine create -d digitalocean --digitalocean-access-token $AUTH-TOKEN docker-node


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.

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.

# This command will provision just two machines
# And they will be named node-1 and node-2 respectively

for i in 1 2 ; do docker-machine create -d digitalocean --digitalocean-access-token $AUTH-TOKEN  node-$i ; done

# To provision, say, 10 machines automatically, use this variation of the command

for i in {1..10} ; do docker-machine create -d digitalocean --digitalocean-access-token $AUTH-TOKEN  node-$i ; done


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.

# The following is the output of docker-machine ls command 

NAME           ACTIVE   DRIVER         STATE     URL                         SWARM   DOCKER    ERRORS
dockerNode-1   -        digitalocean   Running   tcp://           v1.12.4   
dockerNode-2   -        digitalocean   Running   tcp://            v1.12.4   

# And this is the same output when one of the machines has been activated
# Notice that the active machine has an asterisk in its ACTIVE column

NAME           ACTIVE   DRIVER         STATE     URL                         SWARM   DOCKER    ERRORS
dockerNode-1   *        digitalocean   Running   tcp://           v1.12.4   
dockerNode-2   -        digitalocean   Running   tcp://            v1.12.4

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.

# How to activate a machine
# The command takes this form

docker-machine use 

# For example, to activate a machine named dockerNode-1, type

docker-machine use dockerNode-1


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.

# The syntax of the 'docker-machine ssh' command takes this form

docker-machine ssh  

# For example, to log into a machine named node-1, type

docker-machine ssh node-1

# To execute a command on the same host, append the command to the above, like this

docker-machine ssh node-1 apt update

# While we are at it, upgrade the system

docker-machine ssh node-1 apt upgrade -y

# Docker commands are fair game too

docker-machine ssh node-1 docker info

# Or

docker-machine ssh node-1 docker images

# Are there any containers running on the remote machine?

docker-machine ssh node-1 docker ps


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.

# To run the hello-world container on the remote machine, type

docker-machine ssh node-1 docker run hello-world

# Now if you query the system, it will show one inactive container

docker-machine ssh node-1 docker ps -a

# Since the container has outlived its usefulness, trash it 

docker-machine ssh node-1 docker rm 

# And while we're at it, trash the image also?

docker-machine ssh node-1 docker rm hello-world


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.

# Use this command to stop a machine

docker-machine stop 

# Want to destroy it? Use the next command

docker-machine rm 

# This will stop more than one machine

for i in {1..10}; do docker-machine stop node-$i; done

# And this will forcefully destroy them

for i in {1..10}; do docker-machine rm -f node-$i; done



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

Related Post:  Writing a Mesos Framework from scratch with Mesos-starter


Share on facebook
Share on twitter
Share on pinterest
Share on linkedin

Hola! Did you notice that 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.

14 Responses

  1. I think it will be a great OS for you. I’m using this. I could’nt find any trouble in this. It’s a better OS for all PC user.Thanks.

  2. Much of what I see in desktop environment offerings is software chasing hardware — here are shiny new parts do something with them — with minimal concern for benefits to the end user beyond eye candy.

    I’ve been working with computers since the late 1960’s. We continue to approach their use in a strange, almost bizarre way that might be described as: (1) Select a hammer. (2) Look around for what to do with it. An alternate approach might be: (1) I want to do XXX. (2) Which tools are available that related to doing XXX? My brain works the latter way.
    ~~~ 8d;-/ Dan

    1. Umm yeah that’s kind of the point. We don’t want to be forced to use Gnome 3, or any other new paradigm like Windows 8, or OS X. Computers and OS’s are merely a tool. I like Mate because it does what I want, and gets out of my way. As far as I’m concerned Gnome 2 eventually hit a sweet spot, and change for the sake of change is too disruptive.

  3. having tried most desktop environments , ive finally settled for openbox window manager on all 3 installs , 2x arch & 1x sabayon , give the window managers a go.

  4. @ChiJoan: Hi, now Mint does not have anymore LXDE but the closest is Mozillux, ubuntu 12.04 LTS derivative with LXDE desktop. The distribution is full of software (contrary to Lubuntu which is minimalist) so the DVD ISO may seems large to download (less than 2Go). It is intended to work as live-usb or live-dvd and can be installed to hard drive for further customizations, languages preferences etc. The desktop uses only 121 Mo RAM and is really fast, a real pleasure even on old computers. The ISO starts with a menu so you can select english or french, and there are alternatives video cards in case yours is not well recognized (which never hapenned to me and may be quite rare). You can even use Mozillux live-usb on a Mac Apple by using nomodeset option from this menu. A full set of wifi drivers are also pre-loaded so everything works out of the box, multimedia, flash, and there is a very nice suite of software and games you don’t usually find on a Linux distribution. It works really great and is updated at least once in a month, remember to follow their twitter and facebook. They give instructions to build your own live-usb. You can get Mozillux from homepage at

  5. I attempted to add LXDE, since I dislike the Mint Menu and default color scheme on Mint Mate 14. I did it on the Release Candidate, then I hope I upgraded correctly. The LXDE menus are a bit of a mess, and I miss my Google search, so I swapped out my test hard drive for Zorin LXDE 6.1, but had to switch to the 32-bit version, thanks to a message by Mint’s Clem regarding a bug.

    I hope someone forks a LXDE Mint flavor soon, or can give more insight how to tweak the offending parts of Mint Mate.

    Joan in Reno

    1. MATE is basically a fork of GNOME 2 (ported to GTK3?). I tweaked MATE to look like GNOME 2 by changing the color scheme to “Clearlooks” and then adding back the top panel and placing back all the widgets. They’re all there, you just have to play with it a bit until you find the GNOME style ones instead of the MATE style.

      1. It is not that mate does not have its own looks like gnome2 when installed from from its own repositories(i did it in ubuntu clean install).Only Linuxmint team has tweaked to its own style.

      2. Wouldn’t it have been easier to install the cinammon version and then select gnome2 from the login screen? I suspect it’s still there in the Mate version as well.

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

Partner links

1. Attend Algorithm Conference, a top AI and ML event for 2021.
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.


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.