-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
extends not supported in version 3 schema #4315
Comments
cc @dnephin |
I've been wondering, wouldn't adding compose/config/config_schema_v2.1.json#L124-L140 to config_schema_v3.0.json work? I tried doing that locally and it generated output correctly, but I guess it could be breaking other uses. |
Note for others struggeling with this issue: Regarding to the docs: https://docs.docker.com/compose/compose-file/#extends
|
Do we know which version of docker 'extends' will be supported in compose v3? Even if just Indicative? |
I've tried the |
+1 for supporting extend in v3 |
Would it be a lot of effort to support the use of I use extends to manage production, development and test setups and would like to continue doing so outside of swarm mode, but eventually use |
This is the same for me, extends is a really usefull option, which for know cause a hole in hour workflow deployment |
The docs seem a bit misleading ATM:
It reads like |
@willseward I strongly agree with you on this. It's a very ugly hacky solution to do what I'm forced to do right now: $ docker-compose config | sed "s#version: '2\.1'#version: '3'#g" EDIT: This is especially ugly since docker-compose will treat it as 2.1 version syntax, so it will certainly force developers into hacky solutions which will probably also be limited on certain version 3 features. |
@dnephin @shin- @vdemeester can I contribute to add back support of extends for v3.x? What have to be done? I've quickly looked & I guess that this project has to be patched, but at least https://github.com/aanand/compose-file too. |
@dnephin ok so I've seen you've moved aanand/compose-file to moby/moby@f5af9b9 so docker-compose & docker repos needs to be patched in fact. |
What was the reason for removing |
@arun-gupta I guess it's because a lot of docker-compose files parsing is also now done in go in docker engine source code and it's not have been ported from python ATM cc @dnephin right? If yes, the question is to know if it's planned to bring it back or no. Would be nice to also know - if it's a deprecation - if another mecanism is planned to merge some properties from some kind of abstract services (which is the main use case of extends for everyone I guess). |
found this issue, for the same reason as others have already mentioned. I've upgraded to docker-compose v3 to take advantage of some new docker-swarm features, but now extends is no longer supported? WHY!! It is such a useful option for writing clean dockerfiles and managing services in different environments. +1 for bringing this back |
@arun-gupta welcome to how the docker dev's roll out new features, depreciating old sensible functionality for new stuff which hasn't been released yet. Its like a great wet fish in the face, This morning I was all like
20 seconds later
|
Damned I just spent the day to build a nice extend layout for our services. I feel less confident now to justify the time invested in our docker stuff :( |
This document is also rather misleading:
In the section "Upgrading Version 2.x to 3.x" there is no mention of extends being removed. :-( |
I am working on documentation fix. |
I really believe that with the swarm inter-compatibility, the |
At the end of the day, this is dependent on Docker Engine supporting the feature -as a result, I created moby/moby#31101 to track that possibility. Please voice your concerns there if this feature is important to your project! |
Thanks @shin-. I would even be happy if Maybe something like this?
That'd be acceptable for the interim... |
@willseward yes should be cool & a great 1st step probably... but couldn't address a last issue (which was a very kind feature): abstract services. I don't know if you have some but personally - and I'm not the only one - I have this kind of configs very often in some services:
some_service-abstract:
build:
context: .
environment:
- SOME_VAR
image: vendor/service:tag
networks:
- somenet
logging:
driver: gelf
options:
gelf-address: "udp://127.0.0.1:17110"
env: SOME_VAR
some_service:
extends:
file: ./common-services.yml
service: some_service-abstract
environment:
- LISTEN_ON_PORT=8888
expose:
- "8888"
command: server
networks:
- some_other_net
some_service-worker:
extends:
file: ./common-services.yml
service: some_service-abstract
command: worker_cmd
networks:
- some_other_net_take_two So basically @shin- @vdemeester @dnephin what are recommandations for this use case? build:
context: .
environment:
- SOME_VAR
image: vendor/service:tag
networks:
- somenet
logging:
driver: gelf
options:
gelf-address: "udp://127.0.0.1:17110"
env: SOME_VAR |
Also, as I'm convinced that composition has always been greater than inheritance... and as To me the ideal thing would be:
|
@willseward solution is a great one, this not only solves the issue with no longer supporting extend, but it also solves the fact, you can't run docker-compose bundle on multiple docker files to deploy a docker stack. Of course it would be alot easier for docker engine swarm mode to have better inter-compatibility with docker-compose to be able to deploy a stack spread across multiple compose files rather than having to implement a new feature to make a limited experimental feature work. |
I agree that composition lead to more modularity than inheritance. Composition on the other hand does not include hierarchy, what would be the precedence rules ( or merging ) for service options that overlap ? ( Chaining -f does not look like real composition but not persisted inheritance ) The issue when chaining -f is that it is not persisted. |
Whether or not docker supports extends in swarm mode is not even relevant to compose, is it? If I have Why should the above behaviour be any different if I'm using extends? Nothing would actually break from compose's perspective. Fair enough if Running development with three Finally, if compose is able to deal with For the moment we've reverse engineered a python script to assemble a flattened compose file for use with docker-engine, and have left all our files in v2.1, however this makes it significantly more difficult to adjust deployment options as we go. |
@ABitMoreDepth I 100% agree. Having multiple |
+1 "Supporting extends in Docker is the way to go" |
Folks, as I wrote earlier, this is out of my hands at this point. Please comment on moby/moby#31101 instead. |
I'm running Docker 1.13.0-rc4 and current master (545153f) of Compose.
I tried to deploy a stack using following docker-compose.yml file:
Got following in response:
I found an issue about it in Docker's repo (moby/moby#29304) and attempted to run the command given by the error message, which resulted in:
The text was updated successfully, but these errors were encountered: