# Running Docker Compose on a native cluster

Install Docker on a native cluster's server and run services with Docker Compose

*This guide installs Docker by hand on a native cluster's server. To have Hatchbox build and run your app as containers, use a [Dockerfile cluster](/docs/articles/76-dockerfile-clusters) instead.*

Docker Compose can be useful for deploying custom app configurations to your servers with Hatchbox.

## Installing Docker

You'll first need to [install Docker](https://docs.docker.com/engine/install/ubuntu/) on your server as *root*. Then follow the [post-install steps for Docker](https://docs.docker.com/engine/install/linux-postinstall/).

```
$ curl -fsSL https://get.docker.com | sh
```

Add the deploy user to the Docker group:

```
$ sudo usermod -aG docker deploy
```

Configure Docker to start on boot:

```
 $ systemctl enable docker.service
 $ systemctl enable containerd.service
```

## Port Binding

Your web container needs to bind the Hatchbox app's assigned local port so HTTP requests can be forwarded from Caddy to your container.

```
    ports:
      - "127.0.0.1:${PORT}:80"
```

## Project Name

Compose also needs a name for your project so it knows which project to start and stop. You can specify this either in compose.yaml or using an environment variable

**compose.yml**

```
name: my-app
```

**ENV Variable**

```
COMPOSE_PROJECT_NAME=my-app
```

## Build Script

Your application will need a custom build script. This will run on all application servers:

```
docker compose down || true
```

**Note:** Docker Compose *won't* distribute containers across servers with roles in your Cluster. Each application server will run a copy of all the containers.

## Process

Add a Process assigned to the `web` role that runs Docker Compose.

```
docker compose up
```

This process tells Hatchbox to add a `reverse_proxy` to the Caddy configuration to forward requests to your Docker containers.

## Example

We've put together a simple example to run Wordpress + MariaDB using Docker Compose on a Hatchbox server.

[https://github.com/hatchboxio/docker-compose-example](https://github.com/hatchboxio/docker-compose-example)