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:

# First import the GPG key

sudo apt-key adv --keyserver hkp:// \
      --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

# Next, point the package manager to the official Docker repository

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

# Update the package database

sudo apt update

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:

# Installing both packages will eliminate an unmet dependencies error when you try to install the 
# linux-image-extra-virtual by itself

sudo apt install linux-image-generic linux-image-extra-virtual

# Reboot the system so it would be running on the newly installed kernel image

sudo reboot


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.

# Install Docker

sudo apt install docker-engine


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

# Run a Docker container
# This container is just a test container, and it will run and exit

sudo docker run hello-world


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:

# How to search for Docker images

sudo docker search "linux mint"

# The output should be of this sort

NAME                                 DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                               Ubuntu is a Debian-based Linux operating s...   5185      [OK]       
oraclelinux                          Oracle Linux is an open-source operating s...   262       [OK]       
kalilinux/kali-linux-docker          Kali Linux Rolling Distribution Base Image      245                  [OK]
linuxserver/plex                     A Plex Media Server container, brought to ...   191                  [OK]
linuxserver/couchpotato              A CouchPotato container, brought to you by...   142                  [OK]
linuxserver/sonarr                   A Sonarr container, brought to you by Linu...   136                  [OK]
linuxserver/nzbget                   An Nzbget container, brought to you by Lin...   63                   [OK]
amazonlinux                          Amazon Linux is an execution environment f...   43        [OK]       
thewtex/cross-compiler-linux-armv6   Linux ARMv6 cross compiler toolchain for t...   7                    [OK]
thewtex/cross-compiler-linux-armv7   Linux ARMv7 cross compiler toolchain            4                    [OK]
condaforge/linux-anvil               The image used to build x86_64 conda distr...   2                    [OK]
jasonchaffee/kali-linux              Kali Linux Docker Container with the kali-...   2                    [OK]


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:

# Run a Docker container using the official Ubuntu image

sudo docker run -it ubuntu bash


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.

Related Post:  Triple-boot Linux Mint 17.3, Ubuntu 16.04, Windows 10 on a PC with UEFI firmware

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.

# Run a Docker container using the official Nginx image

sudo docker run -p 80:80 nginx
# Alternatively, you can force the container to detach by running this command
sudo docker run -d -p 80:80 nginx


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.

Related Post:  Apply the nuke patch to LUKS cryptsetup in Linux Mint 16 and Ubuntu 13.10

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

# List all containers, running or not
sudo docker ps -a

# The output of the above commands takes this form
# CONTAINER ID      IMAGE        COMMAND              STATUS                PORTS                   NAMES
# 260c12455185        redis   ""  Up 14 seconds          6379/tcp                      jolly_ride
# c43c9f709786        nginx   "nginx -g 'daemon off"  Up 2 minutes>80/tcp, 443/tcp   desperate_ritchie
# 0febde3715a0        ubuntu       "bash"           Exited (0) 5 minutes ago                           infallible_lalande
# 0e5e4b38037a        hello-world    "/hello"          Exited (0) 2 hours ago                             grave_jones

# List only running containers

sudo docker ps

# Remove a stopped container. Specify the container's id or name when removing it
# In this case, we remove the container using its name

sudo docker rm grave_jones

# To remove a running container, first stop it using its name or id
# In this case, we stop it using its id

sudo docker stop 260c12455185

# Then remove it

sudo docker rm 260c12455185

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:

# Listing Docker images
sudo docker images

# Output of above command
# REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
# redis               latest              1c2ac2024e4b        6 days ago          182.9 MB
# ubuntu              latest              4ca3a192ff2a        13 days ago         128.2 MB
# nginx               latest              abf312888d13        2 weeks ago         181.5 MB
# hello-world         latest              c54a2cc56cbb        5 months ago        1.848 kB

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

# Delete a Docker image using its name
sudo docker rmi hello-world

# And in this case, using it id

sudo docker rmi 1c2ac2024e4b

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.

17 Responses

  1. If your a Linux newbee or relative newbee or recent convert from MS windows then I have to say all this Gnome, gnome version 2, gnome 3, gnome shell, MGSE, Mate & Cinnamon stuff is excruciatingly confusing to say the least. Look I’m an intelligent person with quite a few years of IT behind me and even I have had to do extensive research & reading to finally grasp what the difference really is between MGSE and Mate for example. Its very hard and potentially off putting for Linux new people to be confronted with such complexities.

    1. The greatest asset of the free software/open source community, is there is no single controlling entity. And the greatest weakness? There is no single driving force, so you have a myriad of projects trying to do the same thing.

      This results, in many ways, to ill-conceived and weakly executed projects. Most developers seldom take non-technical users into consideration when designing their programs. They code for people just like them.

  2. Well, just like some of the other comments, I am also mystified about this whole thing. Now, me, I am not a linux master but just a user. The command line still for me is irksome, but will go there if need be.
    I use Ubuntu 11.10 on my desktop, and Linux Mint 12 on my laptop.
    Right now, I really don’t like either very much just because of the bugs but those will probably work out. MATE, Cinnamon, and Classic are okay and a big step in getting something going but I say fix what you started and not give something new. (the list at my login screens is getting way too long and a the present time I haven’t the knowledge to shorten them again)
    I need to have something that with two clicks or less, I can find, and start a program and have it rock stable, fully usable and will not crash the system.
    I struggled with the small things back in 2004 when Ubuntu was introduced to me, but I stuck with it and things got better. Changing the alert sound for new mail never worked and I couldn’t figure a way to make it work. I said surely they will fix it soon. You could pick a new sound but I couldn’t get it to play either in Evolution or TB. Late last year, I download LM12 and, wow, here is the sound. Why, did that take 7 years? I know some of you knew how and fixed in 2004 and I tried but gave up and so I just waited. But I think, if you have the option in the program you would kinda think it should work. That is all I ask.
    Now here is another question with all this going on who do you send money for thanking them for their hard work. Do I send it to Ubuntu or Linux Mint? If you send it to Linux Mint and they get the knowledge base from Ubuntu then how could that be fair.
    I like Linux and whatever distro “wins”, I will use. “Wins” is probably a poor term because the way it looks from just a user point of view, that Linux may self destruct from within just because of the different routes being taken (get so many distros that a newbie like me couldn’t make a decision on which one to use or which one is best). And after these years, I still feel like a newbie, maybe I should give up and go back to Ubuntu 10.10 where I did feel more comfortable, even if I couldn’t get the email alert sound to work.
    Thanks for listening to my frustration.

    1. @ Don

      To Play a custom sound file (wav) in Thunderbird please follow the steps given below:

      Downloaded Audacity from the Ubuntu Synaptic repositories. Open from Applications – Sound and Video – Audacity. Close the notification msg on top of Audacity workspace, click file, open and browse to load your desired soundfile. In the project rate box at the bottom my 11025 value showed up in the box.

      Open the box and select 22050. Next your file needs to be saved at this sample rate. However it seems, that although you can save directly, the only way to make the saved version useable by Thunderbird is to use the file – export function from the top menu list. Save the file in the directory of your choosing by exporting and close out Audacity.

      In the Ubuntu Top Menu, select System – Preferences – Sound – Sounds – Desktop/New Email and click on the default sound setting. Choose custom and browse to your new sound file’s directory and select your sound. When done, close out this feature and start up Thunderbird. On the top menu click edit – preferences and under the general heading in when new mail arrives, enable play a sound and use the following soundfile.

      Browse to your soundfile’s directory, select your file, close out this feature and send yourself a test email .

  3. So, you are saying this few weeks old project, with a few developers, hasn’t successfully completed their break from the fork point?
    Color me surprised!
    I FULLY expect every similar software project to be completed within a WEEK and it should only need one developer (if that!).

    Ugh, they are clearly not done with this, and there are months yet before the next Mint release. Relax. I won’t be using Mint b/c Shell is more interesting, has many more developers, is trying a genuinely new interface, but I am grateful for what Mint is trying to do. Really, I wish they’d break completely away from Ubuntu since they are sharing less and less with them.

    1. Exactly…it is only in alpa right now (and yet very stable and very nice to use)…each new version adds in more features…but it is like the foundation of a building…the building itself is in the process of being constructed….By the time Mint 13 arrives it should be very matured and feature rich…Even now it’s nicer to use then either unity OR gnome shell if you prefer a more conventional desktop…

  4. Cinnamon is an alternative to the wretched “Unity”. It needs work but is the best yet effort to create a familiar desktop on the Gnome 3 code base.

  5. I don’t understand all the drama. Good people are wasting hours tinkering with GNOME, basically trying to make it do what KDE already will do. If KDE’s too big, there are always LXDE and XFCE. I’m not a troll – just a 15-year KDE user who’s mystified by all this.

    1. I think there’s a degree of determination to force Gnome 3 to stop being such a grotesque turd of a GUI.
      Merely changing to KDE would be an admission of defeat.

      Don’t understand it myself – KDE treats me like an intelligent being capable of making my own decisions – Gnome treats me like a stupid child who needs everything done for him.

      1. Every aspect of Gnome is out of control if your looking in any way for a complete STABLE desktop, period. Gnome, Unity,Shell and Cinnamon gui are totally out of context with the real world usable desktop.

        Mint 12 has more bugs than a giant ant hill. These Gnome releases all look like beta’s and never should have been released in the first place.

        Everyone in Redmond has to be laughing at Gnome as its no better than there Vista ever was.

        I’ll stick with Fedora 16/kde or Kubuntu 11.10/kde and won’t look back.

        Gnome better wake up as it dosen’t know who their market really is.

        An old expression “Gnome looks like a jack of all trades and a master of none”

        1. Redmond may be laughing at Gnome but they haven’t heard of KDE.
          Also, it’s funny that you say gnome is a jack of all trades where that is EXACTLY what KDE purports to be. It offers tons of gui options, they just aren’t well tested and there is no integration.
          Gnome offers limited options but they are integrated and well tested, hence why you haven’t been hearing widespread cries of instability.

          1. hence why you haven’t been hearing widespread cries of instability.

            A stable turd is still a turd.

            KDE – not integrated and not tested?

  6. I use Cinnamon (not exclusively) and I agree that it’s a refreshing alternative to the horrible mess that GNOME 3 has become. I most often use MATE or XCFE, MATE for its familiarity, and XCFE for a usable, powerful desktop that, in its 4.x incarnation, didn’t try to fix what wasn’t broken.

  7. I was excited about Cinnamon until I saw that it is just as slow as gnome-shell with unaccelerated graphics. Hope it gets fixed otherwise it’s just another WM on the pile of gnome3 framework

    1. Right now, gnome-shell and Cinnamon require 3D enabled video hardware. This is a problem with Gnome’s ‘mutter’. Clement Lefebvre is forking ‘mutter’ as well and one of the goals of this particular fork is to enable 2D gnome-shell and Cinnamon capability.

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.