$ sudo apt-get remove docker docker-engine docker.io
$ sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
Add docker keys and repo
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
Get Docker
$ sudo apt-get update
$ apt-cache madison docker-ce
$ sudo apt-get install docker-ce=18.06.1~ce~3-0~ubuntu
Run docker without sudo
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
LOGOUT and LOGIN to session again
$ docker run hello-world
If any error in above steps, make sure you have logged out and logged in to the shell once. If still doesn't work, try restarting docker service using below commonds
$ sudo systemctl stop docker
$ sudo systemctl start docker
Docker compose installation
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version