Install Docker in ubuntu

Docker is a computer program that performs operating-system-level virtualization, also known as “containerization”. It was first released in 2013 and is developed by Docker, Inc.
Docker is used to run software packages called “containers”. Containers are isolated from each other and bundle their own application, tools, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and are thus more lightweight than virtual machines. Containers are created from “images” that specify their precise contents. Images are often created by combining and modifying standard images downloaded from public repositories.

wikipedia

In this tutorial, you’ll learn how to install and use it on an existing installation of Ubuntu 16.04

Prerequisites

  • Ubuntu 16.04 already installed
  • A docker account in case you want to share your image in docker hub

Install Docker

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

If you face this error curl : command no found , you need firt to install curl using the bellow command :

$ apt get install curl 

At this point , you are able to exec the above command to get the docker file.

Add the Docker repository to APT sources:

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Next, update the package database with the Docker packages

$ sudo apt-get update

Install now

$ sudo apt-get install -y docker-ce

untill the command will finished , type sudo docker to fetch all options.

A little problem is that docker need to run as root , that mean you need to prefix your command by sudo every time you exec a docker command , if you won’t do this boring behavior , check the next section. if not , you are already complete this how-to.

Execute Docker without sudo

if you don’t prefix your command by sudo , may be you’ll have this error message :

Outputdocker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?. See 'docker run --help'.

what you need to do is to dd your username to the docker group :

$ sudo usermod -aG docker ${USER}

To apply the new group , type the following:

$ su - ${USER}

you will be prompted to assert your credentials ,Afterwards, you can confirm that your user is now added to the docker group by :

$ id -nG

It’s done , but what if you want to join another member instead of you. To do that , just type :

$ sudo usermod -aG docker username

Replace the username with the real username of the user you wanna join.

Now , it’s done , and hope that help you .

if you are facing problems , leave message in the comment side and i will reply as fast as possible.

inferom
web developer passionate about new technologies