Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global/default override for all services #4746

Closed
durera opened this issue Apr 19, 2017 · 3 comments
Closed

Global/default override for all services #4746

durera opened this issue Apr 19, 2017 · 3 comments

Comments

@durera
Copy link

durera commented Apr 19, 2017

What I want to do is separate my environment specific tweaks into an override.yml, nothing fancy there ... however my overrides will be exactly the same for every single service deployed & I want to avoid having to write out the same override for every single service (and continually add new sections to the override as new services are introduced).

Instead I would like to create one definition that says "apply to this override to every single service". Does such a concept exist already that I am perhaps missing?

Example ...

docker-compose.yml:

  aservice:
    image: whatever1
    environment:
      FOO: BAR

another docker-compose.yml:

  anotherservice:
    image: whatever2

my docker-compose.override.yml:

  <magickeyword>:
    environment:
      FLIBBLE: flobble
    dns:
      - server1
      - server2

Now, every service deployed would have DNS server1 & server2 and the environment variable FLIBBLE.

I realise I could do this if all services were extending the same base service as I could apply the override to that, but is there anyway to set global/default override without a common extension?

At the moment I have a hack that involves a generated override scanning for any defined services and generate the override file on the fly, but it seems like a use case that I can't be the first person to run into so wondered if perhaps I have just missed the obvious solution to this in compose.

@shin-
Copy link

shin- commented Apr 19, 2017

You could just have a base.yml file in each project folder with a base service containing just your environment key, then have each service extend the base service.

@saml
Copy link

saml commented Sep 27, 2017

This is no longer a good solution given that extends: is removed in 3.x moby/moby#31101

@shin-
Copy link

shin- commented Sep 27, 2017

@saml check out #5140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants