Ubuntu 19.04: Install Docker for container

This article will describe installing Docker. Please see here for usage of Docker.

1 Install Docker

Install Docker.

#!/bin/sh

# Install packages for add-apt-repository.
sudo apt install -y apt-transport-https ca-certificates curl \
     software-properties-common

# Install docker-ce. There is no docker-ce for cosmic yet.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
V=bionic #V=$(lsb_release -cs)
sudo add-apt-repository \
     "deb [arch=amd64] https://download.docker.com/linux/ubuntu ${V} stable"
sudo apt update -y
sudo apt install -y docker-ce

# Add user who uses docker to docker group.
sudo gpasswd -a "${USER}" docker
sudo reboot

2 Execution result

Run hello-world.

$ docker run hello-world
<snip>
Hello from Docker!
<snip>