[Docker Compose][4]is a tool for running multi-container Docker applications. To configure an application’s services with Compose we use a configuration file, and then, executing a single command, it is possible to create and start all the services specified in the configuration.
Docker Compose is useful for many different projects like:
***Development**: with the Compose command line tools we create (and interact with) an isolated environment which will host the application being developed.
By using the[Compose file][2], developers document and configure all of the application’s service dependencies.
***Automated testing**: this use case requires an environment for running tests in. Compose provides a convenient way to manage isolated testing environments for a test suite. The full environment is defined in the Compose file.
Docker Compose was made on the[Fig][5]source code, a community project now unused.
In this tutorial we will see how to install Docker Compose on an Ubuntu 16.04 machine.
### Install Docker
We need Docker in order to install Docker Compose. First, add the public key for the official Docker repository:
Update the packages database and install Docker with`apt`:
```
$ sudo apt-get update
$ sudo apt install docker-ce
```
At the end of the installation process, the Docker daemon should be started and enabled to load at boot time. We can check its status with the following command:
The Docker Hub includes a Hello World image for demonstration purposes, illustrating the configuration required to run a container with Docker Compose.
Create a new directory and move into it:
```
$ mkdir hello-world
$ cd hello-world
```
Create a new YAML file:
```
$ $EDITOR docker-compose.yml
```
In this file paste the following content:
```
unixmen-compose-test:
image: hello-world
```
_**Note:**the first line is used as part of the container name._
Save and exit.
#### Run the container
Next, execute the following command in the`hello-world`directory:
```
$ sudo docker-compose up
```
If everything is correct, this should be the output shown by Compose:
helloworld_unixmen-compose-test_1 exited with code 0
```
Docker containers only run as long as the command is active, so the container will stop when the test finishes running.
### Conclusion
This concludes the tutorial about the installation of Docker Compose on an Ubuntu 16.04 machine. We have also seen how to create a simple project through the Compose file in YAML format.