Guide through installing community Docker edition, known as docker ce.
Prerequisites
- 64-bit Ubuntu 16.04
- non-root user that can sudo
Install Docker
More in-depth explanation of steps available in official documentation.
If starting from clean slate, then:
Follow recommended installs
sudo apt update -yq && sudo apt install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
Add Docker GPG
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Install Docker CE
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt update -yq
sudo apt install docker-ce
Postinstall
You should see something like this when trying to list docker containers:
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.32/containers/json: dial unix /var/run/docker.sock: connect: permission denied
By default, only root users have permission to use docker. To change that, we’ll add our current user to docker
group.
sudo gpasswd -a $USER docker
This step is to avoid logout/login:
sg docker -c bash
If you type docker ps
, instead of error message you should see:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES