# Multiple docker-compose.yml files with rancher-compose?

**URL:** <https://forums.suse.com/t/multiple-docker-compose-yml-files-with-rancher-compose/2995>\
**Category:** Rancher 1.x\
**Created:** [June 1, 2016, 10:03pm UTC](https://forums.suse.com/t/multiple-docker-compose-yml-files-with-rancher-compose/2995 "2016-06-01T22:03:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecliptik](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/ecliptik/32/1068_2.png) [@ecliptik](https://forums.suse.com/u/ecliptik)\
**Post date:** [June 1, 2016, 10:03pm UTC](https://forums.suse.com/t/multiple-docker-compose-yml-files-with-rancher-compose/2995/1 "2016-06-01T22:03:55Z")

</div>

I’ve been reading about the docker-compose feature of Multiple Compose files, where you can customize deployments by piecing together different docker-compose.yml files.

- [https://docs.docker.com/compose/extends/#multiple-compose-files](https://docs.docker.com/compose/extends/#multiple-compose-files)

Is it possible to pass multiple compose files to rancher-compose too? This way you can build a application stack using a docker-compose.yml file that works locally without a Rancher Load Balancer service, and when deploying to Rancher include an additional docker-compose file that adds the Rancher Load Balancer service without having to repeat the application stack.

I’m interested in this because when trying to run docker-compose.yml configuration locally that contains a Rancher Load Balancer, it doesn’t start:

```
docker-compose -f docker-compose-rancher.yml up
Pulling rancher-lb (rancher/load-balancer-service:latest)...
Pulling repository docker.io/rancher/load-balancer-service
ERROR: Error: image rancher/load-balancer-service not found

```

Here’s a docker-compose-rancher.yml file with a Rancher Load Balancer service,

```
rancher-lb:
  ports:
  - 20010:80/tcp
  - 20011:81/tcp
  tty: true
  image: rancher/load-balancer-service
  links:
  - nginx
  stdin_open: true
nginx:
  labels:
    io.rancher.container.pull_image: always
  tty: true
  image: nginx:stable-alpine
  stdin_open: true

```

Removing the rancher-lb service brings the nginx service up without issue. When I first researched this I found [Rancher/load-balancer-service is missing](http://forums.suse.com/t/rancher-load-balancer-service-is-missing/237), which makes sense but one of the questions that was never answered was how to make a compose file that works both locally and in a Rancher enviornment.

If rancher-compose supports extends and multiple compose files, similar to docker-compose, I believe this would solve the issue. Then you could have two files, one that works locally for development and one that uses includes the load balancer for deployment. An example,

**docker-compose.yml** for local development

```
nginx:
  labels:
    io.rancher.container.pull_image: always
  tty: true
  image: nginx:stable-alpine
  stdin_open: true

```

**docker-compose-rancher.yml** for deployment to a Rancher enviornment

```
rancher-lb:
  ports:
  - 20010:80/tcp
  - 20011:81/tcp
  tty: true
  image: rancher/load-balancer-service
  links:
  - nginx
  stdin_open: true

```

Then if you want to test locally using docker-compose

`docker-compose -f docker-compose.yml -p local-nginx up`

To deploy to a Rancher environment you can pass both compose files to make up the stack,

```
rancher-compose --file docker-compose.yml \
                --file docker-compose-rancher.yml \
                --rancher-file rancher-compose.yml \
                --env-file .env.export \
                --project-name ${PROJECT_NAME} \
                up \
                --upgrade \
                --confirm-upgrade \
                --pull \
                -d

```

By allowing multiple files developers can avoid repeating services in multiple compose files that essentially do the same thing, allowing for a cleaner deployment method.

---

<div class="post-metadata">

**Author:** ![andyshinn](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/andyshinn/32/442_2.png) [@andyshinn](https://forums.suse.com/u/andyshinn)\
**Post date:** [June 2, 2016, 3:36pm UTC](https://forums.suse.com/t/multiple-docker-compose-yml-files-with-rancher-compose/2995/2 "2016-06-02T15:36:14Z")

</div>

Sounds like you are looking for [https://github.com/rancher/rancher/issues/2626](https://github.com/rancher/rancher/issues/2626).

---

<div class="post-metadata">

**Author:** ![ecliptik](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/ecliptik/32/1068_2.png) [@ecliptik](https://forums.suse.com/u/ecliptik)\
**Post date:** [June 2, 2016, 5:00pm UTC](https://forums.suse.com/t/multiple-docker-compose-yml-files-with-rancher-compose/2995/3 "2016-06-02T17:00:55Z")

</div>

@andyshinn this is exactly what I needed! I just tried it out with rancher-compose v0.8.2 and it worked as designed. Last time I tried it a few weeks ago with a pre 0.8.0 version it wasn’t working and should have tried it with a newer version before posting.

Thank you.

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [June 4, 2016, 5:35am UTC](https://forums.suse.com/t/multiple-docker-compose-yml-files-with-rancher-compose/2995/4 "2016-06-04T05:35:23Z")

</div>


