Different env-file but same yml with Docker Compose?

前端 未结 3 1483
谎友^
谎友^ 2021-02-03 23:14

I find it quite common that I have multiple environments (for example test and prod) but the Docker containers that I wish to start are the same in both environments. The only d

3条回答
  •  旧巷少年郎
    2021-02-04 00:05

    See Update #2 below. This is now possible!

    This is a much requested feature of Docker Compose. Unfortunately, the answer at the moment is that you can't. I'd recommend subscribing to these GitHub issues to get a better idea when and if this feature gets implemented:

    • https://github.com/docker/compose/issues/495
    • https://github.com/docker/compose/pull/76
    • https://github.com/docker/compose/pull/845

    Issue #495 is actually the most commented in their issue repository at the moment. You are definitely not alone in wanting to do this.

    Update:

    The latest issue tracking is at https://github.com/docker/compose/issues/1377.

    Update #2:

    This functionality has been merged and is available as of Docker Compose 1.5.0. See https://github.com/docker/compose/blob/129092b7/docs/yml.md#variable-substitution for usage information.

提交回复
热议问题