Install Docker Compose In Ubuntu 18.04

Install
  1. Install Latest Docker-compose Ubuntu 18.04
  2. Install Docker Compose On Ubuntu 18.04
  3. Install Docker Compose On Ubuntu 16.04
  1. To see the power of Docker Compose in action, you might like to check out this practical example, How To Configure a Continuous Integration Testing Environment with Docker and Docker Compose on Ubuntu 16.04 (note: this article is for Ubuntu 16.04 rather than 18.04).
  2. Once complete, we can finally install the stable version of Docker. # Install the latest version of Docker Engine Community. Sudo apt-get install -y docker-ce docker-ce-cli containerd.io. At this point, you have an Ubuntu 18.04 running the latest stable version of Docker.
  3. Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 18.04 (bionic). After removing the older version, install Docker and Docker-compose using the following commands. Sudo apt install docker-ce. Sudo apt install docker-ce. Sudo apt install docker-ce.

What is Docker Compose?

Installation of Docker Compose is optional. For those using it, follow our guide below to install. How To Install Latest Docker Compose on Linux. More articles: Install Docker UI manager – Portainer. Ctop – Top command for container metrics. How to Setup Docker Private Registry on Ubuntu 18.04 / Ubuntu 16.04 with Letsencrypt.

Install docker compose on ubuntu 18.04

Compose is a tool for defining and running complex applications with Docker. With Compose, you define a multi-container application in a single file, then spin your application up in a single command which does everything that needs to be done to get it running.

Compose uses a YMLYAML file to configure application’s services. Then, with a single command, all the services can be started or stopped from the configuration.Some reasons you might want to use Compose :

  • Multiple isolated environments on a single host
  • Preserve volume data when containers are created
  • Only recreate containers that have changed
  • Variables and moving a composition between environments

Compose works in all environments: production, staging, development, testing as well as CI workflows.

Using Compose is basically a three-step process:

  • Define your app’s environment with a Dockerfile so it can be reproduced anywhere.
  • Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment.
  • Run docker-compose up and Compose will start and run the entire app.

A docker-compose.yml looks like this:

Prerequisite

Docker Compose relies on Docker Engine. So make sure you have installed Docker Engine before installing Docker Composer.Instructions on installing Docker Engine can be found in the previous blog post: Install Docker on Ubuntu 18.04

Install Latest Docker-compose Ubuntu 18.04

Environment

  • Operating System : Ubuntu 18.04 LTS (64-bit)
  • Processor : Intel® Core™ i7-8750H CPU @ 2.20GHz × 12
  • Memory : 15.3 GiB

Download Latest Version of Docker Compose

Ensure that you have installed curl before running the following command.

Apply Executable Permissions to the Binary

Test the Installation

It will output like below:

Install docker compose ubuntu 18.04 apt

Command line Completion for Docker and Docker Compose

Add docker and docker-compose to the plugins list in ~/.zshrc to run auto completion within the oh-my-zsh shell. In the following example, ... represent other Zsh plugins that have been installed earlier.

Install Docker Compose On Ubuntu 18.04

References

Install Docker Compose On Ubuntu 16.04

  • Compose Overview: https://docs.docker.com/compose/overview/
  • Compose Features: https://docs.docker.com/compose/overview/#features
  • Compose Installation: https://docs.docker.com/compose/install/#install-compose
  • Command-line completion: https://docs.docker.com/compose/completion/