Docker Compose is a Python program that lets you easily deploy multiple containers on a server.
As you start exploring Docker, you'll learn that often to run a certain web-app, you'll need to run various services (like database, web-server etc) in different containers.
Deploying multiple containers is a lot easier with Docker Compose.
In this tutorial, you'll learn two ways of installing Docker Compose on Ubuntu:
Install Docker Compose from Ubuntu's repository This is the easiest and recommend method. Unless you need the latest Docker Compose version for some specific reasons, you can manage very well with the docker compose version provides by Ubuntu. Instructions for installing Docker Engine on Ubuntu. Got multiple Docker repositories? If you have multiple Docker repositories enabled, installing or updating without specifying a version in the apt-get install or apt-get update command always installs the highest possible version, which may not be appropriate for your stability needs.
Install Docker on Ubuntu; Docker Basic Commands; Docker Basic Usage; Uninstall Docker on Ubuntu; Prerequisites. A server running Ubuntu 20.04. A root password is configured on your server. If you want to install Docker on Cloud VPS server, I would recommend the following VPS hosting providers. Vultr: Start at $2.5/month. 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. Check that it’s running: sudo systemctl status docker. The first thing we'll do is install the containerd runtime which will take the place of Docker. Log in to your Ubuntu Server instance and make sure to update apt with the command: sudo apt-get update.
Keep in mind that to use Docker Compose, you must have Docker installed on Ubuntu.
This is the easiest and recommend method. Unless you need the latest Docker Compose version for some specific reasons, you can manage very well with the docker compose version provides by Ubuntu.
Docker Compose is available in the universe repository of Ubuntu 20.04 and 18.04 so make sure to enable it first:
You probably won't need it but no harm in updating the local cache:
Now you can install Docker Compose in Ubuntu using this command:
You can check that Docker Compose is installed successfully by checking its version:
It should show an output like this:
PIP stands for 'PIP Installs Package'. It's a command-line based package manager for installing Python applications.
Since Docker Compose is basically a Python program, you can use PIP to install it.
But before you do that, you need to install PIP on Ubuntu first.
Enable the universe repository first.
Install PIP now:
Now that you have PIP installed use it to install Docker Compose for all users on your Linux system:
Check the Docker Compose version to ensure that it is installed successfully:
You can see that Docker Compose installed via PIP is more recent version.
I hope you were able to successfully install Docker Compose on Ubuntu with this tutorial. Questions and suggestions are welcome.
Join the conversation.