How to install docker-compose on Ubuntu 20.04 Focal Fossa Linux

Compose is a feature for setting up and running multi-container Docker applications. With a single command, you can create and start all the services from your configuration. To learn more about Compose see How To Launch Containers With Docker Compose. The objective of this short guide is to install docker-compose on Ubuntu 20.04 Focal Fossa Linux Server/Desktop.

In this tutorial you will learn:

  • How to install docker-compose from Ubuntu repository
  • How to install the latest docker-compose from the official git repository

docker-compose on Ubuntu 20.04 Focal Fossa Linux

docker-compose on Ubuntu 20.04 Focal Fossa Linux

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed or upgraded Ubuntu 20.04 Focal Fossa
Software docker-compose
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install docker-compose on Ubuntu 20.04 step by step instructions

Install docker-compose from Ubuntu Repository

The recommended approach is to install the docker-compose utility from a standard Ubuntu repository. This will provide you with a stable system and easy updates.

  1. Installing docker-compose requires only a single step. Execute the bellow apt command:
    $ sudo apt install docker-compose
    


  2. Check the docker-compose to confirm the installation:
    $ docker-compose version
    docker-compose version 1.21.0, build unknown
    docker-py version: 3.4.1
    CPython version: 3.7.5
    OpenSSL version: OpenSSL 1.1.1c  28 May 2019
  3. Install the latest docker-compose version from the official git repository

    Sometimes you might want to install the latest version of docker-compose. In this case navigate to the official docker-compose git repository and follow the installation procedure. You can use the below commands while replacing the version number in the URL. Example:

    $ sudo wget -O  /usr/local/bin/docker-compose https://github.com/docker/compose/releases/download/1.25.0/docker-compose-Linux-x86_64
    $ sudo chmod +x /usr/local/bin/docker-compose
    


    Check the version:

    $ docker-compose version
    docker-compose version 1.25.0, build 0a186604
    docker-py version: 4.1.0
    CPython version: 3.7.4
    OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019