Docker

If you’ve read and made use of this article to install Docker on Linux Mint 18 or 18.1, this is the next article in line.

While installing Docker makes it possible to run Docker containers locally on your machine, installing Docker Machine makes it possible to provision servers locally and remotely on supported Cloud service providers like DigitalOcean and AWS with Docker (Engine) pre-installed. Such servers are called Dockerized hosts or managed machines.

So in this article, you’ll learn how to install Docker Machine on Linux Mint 18 or 18.1, with an eye towards using it to provision such machines.

Download and Install Docker Machine

Installing Docker Machine involves downloading its binary to your computer, copying it to the appropriate directory and making it executable. The commands required to get all that done are given in this code block. Note that at the time of this publication, Docker Machine 0.8.2 is the latest, stable release. The development branch is at v0.9.0 RC2. You might want to keep track of the very latest release here.

# Download the Docker Machine binary for Linux

wget https://github.com/docker/machine/releases/download/v0.8.2/docker-machine-$(uname -s)-$(uname -m)

# A file called docker-machine-Linux-x86_64 is now on your computer
# Move it to the /usr/local/bin directory, renaming it to docker-machine in the process

sudo mv docker-machine-Linux-x86_64 /usr/local/bin/docker-machine

# Make it executable

sudo chmod +x /usr/local/bin/docker-machine

# Verify that it's installed

docker-machine version
# Output follows
> docker-machine version 0.8.2, build e18a919

#

Install Extra Bash Scripts

With Docker Machine installed, there are three additional Bash scripts needed to be installed that will make using the docker-machine command a bit easier. The scripts, and the functionality they bring to the table, are:

  • docker-machine.bash: This provides command completion for commands, machine names and filepaths
  • docker-machine-prompt.bash: This makes it possible to see the active machine in your shell prompt
  • docker-machine-wrapper.bash: This adds a docker-machine use subcommand to switch the active machine
Related Post:  What does --selinux-enabled do?

The three Bash scripts will need to be linked to the /etc/bash_completion.d directory. The following commands shows how to link all three scripts:

# Each command will download and link each file to the appropriate directory
# For the first file, use this command

sudo wget https://raw.githubusercontent.com/docker/machine/master/contrib/completion/bash/docker-machine.bash \
 -O /etc/bash_completion.d/docker-machine.bash

# Use this for the second file

sudo wget https://raw.githubusercontent.com/docker/machine/master/contrib/completion/bash/docker-machine-wrapper.bash \
 -O /etc/bash_completion.d/docker-machine-wrapper.bash

# And for the third, use this

sudo wget https://raw.githubusercontent.com/docker/machine/master/contrib/completion/bash/docker-machine-prompt.bash \
 -O /etc/bash_completion.d/docker-machine-prompt.bash

#

That last file – docker-machine-prompt.bash – requires additional configuration. You need to modify the PS1 environment variable so that it would function correctly. The PS1 environment variable you need to modify is in the .bashrc file under your home directory. Use the follow commands to modify it.

# Open the .bashrc file

nano ~/.bashrc

# There are four lines starting with PS1, but look for the second occurrence, between else and fi
# It should read:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] '

# Append $(__docker_machine_ps1) to it so that it reads:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\]$(__docker_machine_ps1) '

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

source .bashrc

#

That’s all you need to do to install Docker Machine on Linux Mint 18 and 18.1. The next step is to start provisioning Dockerized hosts (machines) with it. That will be the subject of the next article, which will be published latest Friday, December 16 (2016).

Related Post:  Linux Mint Debian review

If you need to look at the code for the three Bash scripts, you’ll find them here. For more information on Docker Machine, click here.

Docker on Linux Mint 18

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

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.

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.