If you run a Debian-based distro that does not have Docker…
If your distro does not ship Docker (Debian doesn’t, for example), then you’ll have to add the appropriate repository. These instructions may be slightly different for your distro. The instructions below are for Debian. You can find more distro-specific install instructions here.
Add the Docker Repository
This installs some helpful repository-managing tools:
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg2 \
software-properties-common
We’ll add Docker’s GPG key:
$ curl -fsSL "https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg" | sudo apt-key add -
Next, we’ll add Docker’s repository:
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable"
Now we can install Docker (community edition):
$ sudo apt-get update && sudo apt-get install docker-ce
To check that Docker is running, you can use ps as follows:
$ ps aux | grep docker
root 1990 1.6 2.2 779588 46836 ? Ssl 19:30 1:17 /usr/bin/dockerd -H fd://
root 2003 0.0 0.5 636304 11224 ? Ssl 19:30 0:02 docker-containerd -l unix:///var/run/docker/li
bcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libconta
inerd/containerd --shim docker-containerd-shim --runtime docker-runc
Add yourself to the docker group
$ sudo usermod -a -G docker $(whoami)
You will have to either log out and log back in, your start a new session under your username for this to take effect.
You can use the groups command to confirm that you’re in the docker group:
$ groups | grep "docker"
... docker ...
Getting Further Help
Further distro-specific instructions can be found here.