Docker on Linux Mint 18

Docker is an open source project supported by a commercial entity of the same name that makes it super-easy to run an application process inside a relatively isolated environment called a container. Unlike a virtual machine (VM), which has its own kernel, a container is dependent on the host operating system’s kernel.

As a result, it’s much lighter and boots up much faster. It’s the simplest tool that puts enterprise-class application deployment and management capabilities right on your desktop (laptop). By default, Docker containers are run using application images hosted on Docker Hub.

In this article, we’ll go through the process of installing and using it to run containers on Linux Mint 18 and 18.1. Linux Mint 18.1 is set to be released very soon, but these instruction will work on it too.

Enable Official Docker Repository on Linux Mint 18/18.1

The official repository of Linux Mint 18 and also 18.1, which are both based on Ubuntu 16.04, contain a slightly outdated edition of the Docker package than is available on Ubuntu 16.10 or Fedora 25 (see How to install Docker and run Docker containers on Fedora 25). For example, if you attempt to install it (Docker) from the official Linux Mint repository, you will likely be installing Docker 1.12.1, as opposed to the very latest (at the time of this writing) – Docker 1.12.3.

So to make it such that the latest and greatest version of Docker will always be available on your system, it’s better to enable the official Docker repository. To get that done, run the following commands:

Install Docker Prerequisites on Linux Mint 18/18.1

To install and successfully run Docker containers on Linux Mint 18 and 18.1, even after kernel upgrades, use the following command to install a few required packages:

Install Docker on Linux Mint 18/18.1

Now that all is set, you may install Docker using the next command, which will not only install it, but also start the daemon and enable it, so that it will always start at boot.

Run/Manage Docker Containers on Linux Mint 18/18.1

The Docker daemon is up and running, so you may now run your first container using the following command

As stated earlier, images used to run Docker containers are, by default, hosted on Docker Hub. With hundreds, perhaps thousands of images available, how do you find an image with which to run a container? By using Docker’s search command. For example, let’s see if Linux Mint has an image hosted on Docker Hub:

Related Post:  Dual-boot Linux Mint 11 and Windows 7

When searching for an image to run a container, always use one with OK in the OFFICIAL column. That indicates it came from the project itself, not from any random person. In the output above, for example, there’s no official image for Linux Mint, but there’s one for Ubuntu and Oracle Linux. So let’s try and run a container using the official Ubuntu image:

The above command will download the Ubuntu image, run the container, keep it running, and give you interactive tty access inside it, with the Bash shell. You’ll notice that your command prompt has changed to something like root@131a58505d2d:/#, where the string after the @ sign is the unique id of the container. So your host machine is running Linux Mint 18, but you’re now operating from inside an Ubuntu container.

With command line access inside the container, you can do anything you want, like just exit the container, or do somethings more interesting, like update the package database, upgrade the system, and install any software you feel like installing. For now, you may exit the container by typing exit. In a future article, we’ll go into details of how to install applications inside a container, commit the changes, and push the new image derived from that to Docker Hub.

Let’s end this by running another container using the official Nginx image. By default, running the Nginx container will expose its ports 80 (http) and 443 (https). What this command does is map port 80 on the host machine to the equivalent port inside the container.

Related Post:  How to customize Linux Mint 9

Mapping the port in that fashion makes it possible to access the default Nginx page by pointing your browser to the host machine’s IP address. If you did that, you should see the default Nginx page, and if you ran the command without the -d option, you should see some output indicating that the page has been accessed. Depending on the host machine’s resources, you can run as many containers as you want – at the same time.

Use the next set of commands to list the containers running on the host machine, stop a running container and remove a stopped container:

Clean Up After Yourself

Whenever you run a container, the Docker client has to download an image from (by default) Docker Hub. The images are stored on your computer, and will remain there even after you’ve stopped and removed the container. With time, those images can take up a significant chunk of your computer’s storage space.

So a good habit to adopt is to delete those images you’ll not be using anytime soon. To list the images stored on your computer, type:

Don’t think you’ll be needing an image anytime soon? Delete it:

Running individual Docker containers like you just read in this article is fun, but that’s just the beginning. Docker has other features, like the Swarm Mode, which makes it easy to orchestrate a cluster of Docker containers across a cluster of servers running Docker. The next article will show how to install Docker Machine on Linux Mint 18/18.1. Docker Machine is used to provision servers running Docker. More on Docker here.

Docker on Linux Mint 18


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.

7 Responses

  1. I was having trouble running docker images, i unistalled it, then reinstalled using this commads and worked like a charm, thanks

  2. Hello,

    thank you for this article. You said:

    “Now that all is set, you may install Docker using the next command, which will not only install it, but also start the daemon and enable it, so that it will always start at boot.”

    But I do not wish to have it always start at boot. What should I input and what commands should I use to start it manually?

  3. I followed these instructions to elliminate an error I was getting when trying to use docker from WSL.
    Ironically after Installing Linux Mint and following the instructions here I am getting the same error I was before.
    sudo docker run hello-world
    docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
    See ‘docker run –help’.

  4. Hey,

    Thanks for the guide! One thing I found in my installation:

    sudo apt-add-repository \'deb ubuntu-xenial main\' was not working for me as as it gave out this error when doing sudo apt update:

    Err:11 serena Release 404 Not Found

    However, adding a trailing slash to the repo helped.

    sudo apt-add-repository \'deb ubuntu-xenial main\'

Leave a Reply to Ammar Shareef Cancel 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.


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.