How to Install Docker Community Edition on Linux Mint 19

6689
Share:
how-to-install-docker-community-edition-on-linux-mint-19

As a full-time web developer, my daily task is to develop a website. Well, that's kinda obvious. But there are some skills required to support my main task:

  • Sysadmin. Stuffs like ssh, sudo, apt and so on.
  • Networking. Utilities like ping, nslookup, iptables etc.
  • A little hacking. Something like running MacOS on a non Mac devices.

Off course running my own server is fun, but there are times when I must spend a day or two to figure some misconfiguration. The application runs fine on my machine, but when it's deployed on server, something is broken. There's even a meme for this situation:

But it works on my machine

Well, ideally this shouldn't ever happened. It potentially waste our time as a developer. We should just focus on our development task and shouldn't troubleshooting server's environment.

Then I heard about this Docker container. My initial response is "Wow, this is what I'm looking for. Let's try it."

About Docker

As published on Wikipedia, Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines.

The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Docker, Inc. Docker Engine is available in Community Edition (CE) and Enterprise Edition (EE). We'll cover the installation of Docker Community Edition on Linux Mint 19 using below steps.

Update Local Packages and Install Dependencies

First, make sure our packages are up-to-date. Then, install all the packages used by Docker as dependencies. Open up a terminal and type this command:

$ sudo apt update && sudo apt upgrade -y
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common

Add Docker GPG Key and Repository

We need to add Docker GPG key used for signing Docker packages and add Docker upstream repository to our Linux Mint 19. This is necessary step so we can install the latest stable release of Docker.

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"

Docker Installation

Now is the main installation process. We will install the latest version of Docker CE and Docker Compose.

Update local package index:

$ sudo apt-get update

Then install the latest version of Docker CE and Docker Compose:

$ sudo apt install docker-ce docker-compose

Let's sit back and relax until this process completed. When it's completed, the docker group is created but no users are added. To be able to use Docker, add our normal user to the group to run Docker commands as non-privileged user.

$ sudo usermod -aG docker $USER

To make this change effective, we need to log out and log back in so that our group membership is re-evaluated.

Verify Installation

Next step is verify that our installation is successful. Let's run a test Docker container:

$ docker run --rm -it  --name test alpine:latest /bin/sh
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
e6b0cf9c0882: Pull complete
Digest: sha256:2171658620155679240babee0a7714f6509fae66898db422ad803b951257db78
Status: Downloaded newer image for alpine:latest

It should show a shell like this:

/ # 

If it does, congratulations, we've successfully installed Docker Community Edition on our Linux Mint 19.

Final Words

Well, that's it. I hope that you now know how to install Docker Community Edition on Linux Mint 19 (19 Tara, 19.1 Tessa, 19.2 Tina). If you run into any issues or have any feedback feel free to drop a comment below.

 

Tags Linux
Share:

4 comments

  1. You are missing a newline character between the "$" and the "-" above, in the "Add Docker GPG Key and Repository" step above. Your one long commands needs to be split into two commands, right in the middle of the "$-".

  2. The line of code:

    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"

    should be split to become:

    $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"

  3. Hello followed your instructione but got error:
    gpg: ongeldige optie "-$"
    (23) Failed writing body

    For your information: "ongeldige optie" means "invalid option". translated from dutch)
    Hope you can give me correct install instructions.
    Thnx, Marco

    • Hello Marco,

      What was the command you've typed so that error shown up?

Leave a reply

Your email address will not be published. Required fields are marked *