How to install Docker & Docker-compose on Ubuntu 18.04

Login to the server using ssh terminal or putty

First, install docker using the below command

sudo apt-get update

 sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common

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

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

 sudo apt-get -y update
 sudo apt-get -y install docker-ce

 sudo usermod -a -G docker $(whoami)

After that, install the latest version of docker-compose (the below version may not be the latest, please check the official Docker site). Type below command

sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version

Leave a Reply