Snippets Docker / Installation

Docker Installation

By Marcelo Fernandes Jul 26, 2017

Installation

The docker instalattion is pretty straight forward, just follow these simple steps:

Installing from command line:


# Uninstall older versions of docker:
sudo apt-get remove docker docker-engine docker.io

# Recommended extra packets for Trusty 14.04 (optional):
sudo apt-get update

sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual

# Update the package
sudo apt-get update

# Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

# Add Docker's official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

# Set up the stable repository (change xenial for the ubuntu version that you use):
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"

# Update the apt package index
sudo apt-get update

# Install the latest version of docker CE
sudo apt-get install docker-ce

# Verify that docker is installed properly
sudo docker run hello-world

# or verify if its running
sudo systemctl status docker

Installing from a package:

Go to https://download.docker.com/linux/ubuntu/dists/ and choose your Ubuntu version, browse to pool/stable and choose amd64, armhf or s390x. Download the .deb and then:


# debian package extraction:
sudo dpkg -i /path/to/package.deb

# Verify if the docker is installed properly
sudo docker run hello-world


Running Docker with sudo Privileges:


# add username to the docker group
sudo usermod -aG docker ${USER}

# apply the new group membership
su - ${USER}

# confirm the changes
id -nG


Notes


References:

link 1
link 2