This tutorial helps you to install Docker compose on a Ubuntu 20.04 LTS Linux system.

Prerequisites

A system running Ubuntu 20.04. Pre-installed Docker service on Ubuntu 20.04. Terminal access with sudo privileged account.

Install Docker Compose on Ubuntu

Docker compose binary is available on official Github release. Use curl command line tool to download docker compose binary and place under the PATH environment to make it available globally. First, make sure you have latest curl binary installed on your system. Now, confirm the latest docker-compsoe binary version on Github releases page. At the time of this writing this tutorial, the current stable version is 1.29.2. The following command will download the docker-compose binary version 1.29.2 and save this file at /usr/local/bin/docker-compose. Make the binary docker-compose file executable Verify the the docker-compose version by running the followign command. Output:

Run a Docker Compose Example

At this stage Docker compose have been configured on your Ubuntu system.

Conclusion

This tutorial helped you to install and use docker-compose on Ubuntu systems. The above instructions can be used on Ubuntu 16.04 LTS and above systems. Add the following content to file. The above content shows that we are using latest version of docker compose version 3. Next, we defined a service “web” under sevices section. This will launch a docker container using pre-build “php:8.0-apache” AMI. The “html” directory in current folder will be mounted to containers /var/www/html directory. Keep your file in editing mode. Keep your file in editing mode… Save you file and close it.

How to Install Docker Compose on Ubuntu 20 04   TecAdmin - 58How to Install Docker Compose on Ubuntu 20 04   TecAdmin - 92How to Install Docker Compose on Ubuntu 20 04   TecAdmin - 52