Install Docker in Linux Mint 19.1

docker-containers-unixtutorial

One of the first things I wanted to try on my fresh Linux Mint 19.1 install was Docker. This post captures the steps I’ve taken to get Docker CE (community edition) version installed on my Linux-based Dell XPS laptop.

Docker in Linux Mint

Since Linux Mint is based on Ubuntu, you shouldn’t have any issues getting Docker installed from the official repository of Docker.io.  I have followed instructions from here: Docker Docs – Install Docker CE in Ubuntu.

I followed instruction pretty much word for word, except the part where you’re adding a new apt repository to your Linux Mint.

In the procedure fully documented below, I have changed this command:

greys@xps:/$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

to this:

greys@xps:/$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"

This is because Linux Mint has its own version names and they don’t match Ubuntu ones. But because I know that Linux Mint 19.1 is based on Ubuntu Bionic, I just made the replacement as shown above.

Install Docker CE in Linux Mint 19.1

Here are the full steps for the installation.

Installing Additional Packages

greys@xps:/$ sudo apt-get install \
> apt-transport-https \
> ca-certificates \
> curl \
> gnupg-agent \
> software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20180409).
The following additional packages will be installed:
dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf
gpgsm gpgv libcurl4
Suggested packages:
tor parcimonie xloadimage scdaemon
The following NEW packages will be installed:
apt-transport-https gnupg-agent software-properties-common
The following packages will be upgraded:
curl dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server
gpgconf gpgsm gpgv libcurl4
13 upgraded, 3 newly installed, 0 to remove and 232 not upgraded.
Need to get 2,535 kB of archives.
After this operation, 224 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
...

Add Ubuntu version of Docker Repository To Our System

greys@xps:/$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
greys@xps:/$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) <[email protected]>
sub rsa4096 2017-02-22 [S]
greys@xps:/$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
greys@xps:/$ sudo apt-get update
Hit:1 http://archive.canonical.com/ubuntu bionic InRelease
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Hit:6 https://download.docker.com/linux/ubuntu bionic InRelease
Ign:7 http://packages.linuxmint.com tessa InRelease
Hit:8 http://packages.linuxmint.com tessa Release
Fetched 163 kB in 1s (239 kB/s)
Reading package lists... Done
greys@xps:$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
Recommended packages:
aufs-tools cgroupfs-mount | cgroup-lite git pigz
The following NEW packages will be installed:
containerd.io docker-ce docker-ce-cli
0 upgraded, 3 newly installed, 0 to remove and 243 not upgraded.
Need to get 50.4 MB of archives.
After this operation, 242 MB of additional disk space will be used.
Get:1 https://download.docker.com/linux/ubuntu bionic/stable amd64 containerd.io amd64 1.2.2-3 [19.9 MB]
Get:2 https://download.docker.com/linux/ubuntu bionic/stable amd64 docker-ce-cli amd64 5:18.09.2~3-0~ubuntu-bionic [13.2 MB]
Get:3 https://download.docker.com/linux/ubuntu bionic/stable amd64 docker-ce amd64 5:18.09.2~3-0~ubuntu-bionic [17.4 MB]
Fetched 50.4 MB in 5s (10.8 MB/s)
Selecting previously unselected package containerd.io.
(Reading database ... 259022 files and directories currently installed.)
Preparing to unpack .../containerd.io_1.2.2-3_amd64.deb ...
Unpacking containerd.io (1.2.2-3) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../docker-ce-cli_5%3a18.09.2~3-0~ubuntu-bionic_amd64.deb ...
Unpacking docker-ce-cli (5:18.09.2~3-0~ubuntu-bionic) ...
Selecting previously unselected package docker-ce.
Preparing to unpack .../docker-ce_5%3a18.09.2~3-0~ubuntu-bionic_amd64.deb ...
Unpacking docker-ce (5:18.09.2~3-0~ubuntu-bionic) ...
Setting up containerd.io (1.2.2-3) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Processing triggers for ureadahead (0.100.0-20) ...
ureadahead will be reprofiled on next reboot
Processing triggers for systemd (237-3ubuntu10.9) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up docker-ce-cli (5:18.09.2~3-0~ubuntu-bionic) ...
Setting up docker-ce (5:18.09.2~3-0~ubuntu-bionic) ...
update-alternatives: using /usr/bin/dockerd-ce to provide /usr/bin/dockerd (dockerd) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (237-3ubuntu10.9) ...

Listing Docker Containers

There shouldn’t be any:

greys@xps:/$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

Checking Docker Version

greys@xps:/$ docker --version
Docker version 18.09.2, build 6247962

Installing hello-world with Docker

greys@xps:/$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.

To try something more ambitious, you can run an Ubuntu container with:

$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

That’s it!

See Also