Install Docker And Docker Compose On Ubuntu 18.04

/ Comments off

Jan 27, 2021 Install Docker Compose Ubuntu. Docker Compose available in a single binary file. So you don’t need to install it from the Ubuntu repository. At the time of writing this article, the latest version of Docker Compose is 1.28.0. Before downloading the Docker Compose, I would recommend visiting the Docker Compose download page for the latest.

In an effort for setting development tools in the most economical way (and also learn stuff about as much as possible), I am now trying to install docker-compose on a fresh Ubuntu 18.04 instance.

At the end, an nginx is supposed to run at startup and display a generic page.

Install latest docker-compose on ubuntu 18.04


A system running Ubuntu 18.04; A user account with sudo privileges; Docker installed on Ubuntu 18.04; A command-line/terminal window (Ctrl-Alt-T) Steps for Installing Docker Compose on Ubuntu Update Software Repositories and Packages. Start by updating the software repositories and software packages. Open a terminal window, and enter the following. Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 18.04 ( bionic ). Finally, install Docker: sudo apt install docker-ce. Docker should now be installed, the daemon started, and the process enabled to start on boot.

  • the OS is already installed;
  • ufw is enabled, ports 80 and 443 are accesible;
  • the OS already has a custom user with sudo privileges (e.g. user);
  • we have a domain name pointing at the IP of the server (e.g. and also a CNAME record (*;
Install Docker And Docker Compose On Ubuntu 18.04

Install docker

  • sudo apt update
  • sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
  • curl -fsSL sudo apt-key add -
  • sudo add-apt-repository
    'deb [arch=amd64]
    $(lsb_release -cs)
  • sudo apt update
  • sudo apt upgrade -y
  • apt-cache policy docker-ce
  • sudo apt install docker-ce
  • sudo systemctl status docker
  • sudo usermod -aG docker ${USER}
  • su - ${USER}
  • id -nG

Install docker-compose

  • sudo curl -L -s-uname -m -o /usr/local/bin/docker-compose
  • sudo chmod +x /usr/local/bin/docker-compose
  • docker-compose --version

Setup Nginx

  • sudo mkdir -p /app
  • cd /app
  • sudo touch docker-compose.yml
  • sudo nano docker-compose.yml
  • docker-compose up -d
  • Access and here you should see the default nginx page.


  • crontab -e
    You can use crontab -u <username> -e to execute the following command as a specific user;
  • add: @reboot (sleep 60 ; su user -c 'cd /app ; /usr/local/bin/docker-compose down ; /usr/local/bin/docker-compose -f docker-compose.yml up -d --build')&
  • sudo reboot
  • should still be accesible after server starts;
  • should also be aviable, with the same content.


Install Docker And Docker Compose On Ubuntu 18.04ntu 18 04

Install Docker And Docker Compose On Ubuntu 18.04

Install Docker And Docker Compose On Ubuntu 18.04 Windows 7