How to install Docker Machine on Linux Mint 18 and 18.1

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:  Use NVIDIA-Docker to deploy machine learning models

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 13 MATE/Cinnamon 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

Newsletter: Subscribe for updates

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Get the latest

On social media

Security distros

Hacker
Linux distros for hacking and pentesting

Crypto mining OS

Bitcoin
Distros for mining bitcoin and other cryptocurrencies

Crypto hardware

MSI GeForce GTX 1070
Installing Nvidia GTX 1070 GPU drivers on Ubuntu

Disk guide

LVM
Beginner's guide to disks & disk partitions in Linux
Categories
Archives
0
Hya, what do you think? Please comment.x
()
x
Algorithm 2020

Did you get your ticket yet?

Algorithm 2022 is a 3-day conference on blockchain, cryptocurrencies and AI set for Feb. 10 – 12, 2022, in Dallas. Speakers from the US Air Force, Ministry of Digital Transformation, Ukraine, and more. click that button to learn more and get your ticket. Use BSD20 code for 20% off ticket price.