How to Get Install Docker Compose On Ubuntu 20.04 LTS

Install Docker compose on Ubuntu or any other Linux Distribution for the real power of Docker in a pretty simple way.

Docker-compose is a utility tool to run one or more containers at once using a YAML file. In Windows and Mac, you do not need to install docker-compose, but for Linux, you need to download.

This article will show you how to install docker-compose on Ubuntu or any Other Linux Distributions, and I’ll perform all the steps into the Ubuntu machine. I’m pretty sure it will work on all major distro.

Prerequisites

Step’s to Install Docker Compose on Ubuntu

There are multiple ways to Install docker like:

  • Install Docker compose from Ubuntu Repository (Most of the time, you will end up with an older version)
  • Install Docker compose from Official Git Repository (Always latest version or release)

I’ll always prefer to download and install packages from the Official source rather than the Ubuntu repository.

Install Curl on Ubuntu

To follow the below step, we need to make sure the curl is installed. How to check curl is installed or not? type

curl --version

If you get the output like “curl: command not found” or “Command ‘curl’ not found, but can be installed with:” this error indicates you to install curl.

Before installing curl, make sure to update the Ubuntu repository and once it gets completed, pass the below command and for a while to finish the installation process.

$ sudo apt install curl

Now type the below command to check the curl version:

$ curl --version

Output
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

Install Docker Compose from Official Git Repository

From the above step, we have installed curl on our system. To Install Docker Compose go to the terminal and clear the previous output using Ctrl + L and pass the set of commands.

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

The latest version of docker-compose was 1. 29. 2 at the time of writing this article. There is a high possibility version may differ when you read this article; therefore, check the latest release from the GitHub page and replace 1. 29.2 with the latest release version.

Download Docker-Compose using curl command
Download Docker-Compose using curl command

I think the above command is self-explanatory; however, I thought it would be better to explain what this command will do.

  • curl:- curl command, which stands for client URL, and It’s used to transfer data from server to remote pc.
  • -L:- It will redirect to the specified link
  • 1. 29. 2:- Docker-compose version. If you want to download a different version, replace it with a new or older version.
  • $(uname -s)-$(uname -m):- This command will print kernel name and machine architecture “Linux-x86_64”.
  • -o:- It will save the file to a specified directory.

Give Executable permission to docker-compose

The next step is to provide executable permission to docker-compose. Otherwise, you will not be able to run it.

To update permission, do copy-paste the below command into your terminal screen:

$ sudo chmod +x /usr/local/bin/docker-compose

Finally, check the docker-version to confirm it’s working as per our intend:

$ docker-compose --version

Output
docker-compose version 1.29.2, build 5becea4c

Uninstallation

It’s quite simple to remove or uninstall docker from your system pass the single line of command:

$ sudo rm /usr/local/bin/docker-compose

Isn’t quite simple?

Wrapping Up

That’s all for How To Get Install or enable Docker Compose On Ubuntu 20.04 LTS.

Read this to :- How to resolve Cannot connect to Database server (mysql workbench)

If you are stuck somewhere, please feel free to comment down and If you like the article, or somewhere I missed something, please let me know to make this article more amazing.

Leave a Reply