What is Docker?

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers.

Docker allows developer to create a container for app that holds all dependencies required. Docker is similar to virtual machine accept it runs on a host machine rather then creating whole os.

Why Do I need Docker?

Imagine that you are working on a project you have installed necessary dependencies for your project you ran it and it worked fine however you send your code to your friend he runs the same code on his machine and gets different results.

He might be seeing different version on his machine or something else. Docker is trying to solve this issue imagine docker as a virtual computer inside your computer.

This virtual computer contains all of your project related configurations and dependencies you can send this virtual computer to your friend and now this virtual computer will run on his computer.

He will see the same result as you because it is the same container you created. You can easily create different types of containers. You can easily destroy them if you don't need them.

How to install docker on ubuntu?

To install docker on linux machine you need to add repository for docker. Open your linux terminal window and run following commands to install docker on linux:

# update your ubuntu
sudo apt-get update

# add docker dependencies
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

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

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

# update your ubuntu
sudo apt-get update

# install latest version of docker
sudo apt-get install docker-ce

# list available versions
apt-cache madison docker-ce

# above command will have sample output as below
docker-ce | 18.03.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages

# get version from above output
# and install specific version
sudo apt-get install docker-ce=18.03.0~ce-0~ubuntu

# run sample hello-world image
sudo docker run hello-world

Install Docker on Mac OS

To install docker on MacOS click on the link below to install:

Download Docker for Mac OS