How to install docker

Install Latest Docker and Docker-compose on Ubuntu 18.04

docker cli is used when managing individual containers on a docker engine. It is the client command line to access the docker daemon api.

docker-compose cli can be mainly to orchestrate a multi-container application. It also moves many of the options you would enter on the docker run cli into the docker-compose.yml file for easier reuse. It works as a front end “script” on top of the same docker api used by docker, so you can do everything docker-compose does with docker commands and a lot of shell scripting. See this documentation on docker-compose for more details.

Step 1 – Add Apt repo for Docker packages

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] bionic stable"

Step 2 – Install docker-engine

sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce

Step 3 – Start & Enable docker service

 sudo systemctl status docker

Syntax : systemctl <options> <service-name>

<options> are status | start | stop | restart

sudo systemctl restart docker
sudo systemctl enable docker

Step 4 – Executing Docker Commands without Sudo (Optional)

sudo usermod -aG docker ${USER}
su - ${USER}
id -nG

Step 5 – Install Docker-compose

sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

Also Checkout these Post