Debian 9: Install docker-engine for container

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

1 Install docker-engine

The following script will install docker-engine.

  • Add user to docker group for using docker command withou sudo.

set -e

# Install dependencies.
sudo apt install -y curl apt-transport-https \
     software-properties-common ca-certificates

# Install docker.
curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb \
debian-$(lsb_release -cs) \
sudo apt-get update -y
sudo apt-get install -y docker-engine

# Run docker.
sudo systemctl start docker
sudo systemctl enable docker

# Add user to docker group for using docker without sudo command.
sudo gpasswd -a "${USER}" docker

# Reboot
sudo reboot

2 Execution result

Run hello-world.

$ docker run hello-world
Hello from Docker!