Docker Installation in Ubuntu 16.04
Docker version check
$ docker –version
Set up the repository
Update the apt package index and install packages to allow apt to use a repository over HTTPS:
$ sudo apt-get update
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
Verify that you now have the key with the fingerprint
$ sudo apt-key fingerprint 0EBFCD88
Add the Docker repository to APT sources:
$ sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
$ sudo apt-get update
Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo:
$ apt-cache policy docker-ce
Install Docker Engine
$ sudo apt-get install -y docker-ce
Executing the Docker Command Without Sudo (Optional)
If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:
$ sudo usermod -aG docker ${USER}
$ su – ${USER}
To verify
$ id -nG