-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
compose parser fails 3.4+ schema for volume
with external
, driver
, driver_opts
, labels
#2272
Comments
branch with fix + test cases v18.09.5...diablodale:fix-loadvol1 |
Fro info the reason this rule has been relaxed (docker/compose@aaa0773) is to allow For my information can you please explain in which scenario you need to declare both |
Looking at v18.09.5...diablodale:fix-loadvol1 your fix sounds good. I personnaly would just remove this whole check, as it only check for a legacy fields combination that is now considered valid because additional attributes (but |
Personally, I want to use I'm neutral regarding the fix as I've written and your preference to remove the denial on 3.0-3.3. I wrote the fix to match the schema. However, the core team for this project might have a different philosophy regarding such topics. It's easy for me to adjust the fix and test cases for either approach. Is there a second opinion from the core team that would add value here? |
Does this relate to aws/amazon-ecs-cli#927 ? According to comments found here, |
A few comments.... External means something slightly different then you wrote according to docker reference documentation. "external: If set to true, specifies that this volume has been created outside of Compose. docker-compose up does not attempt to create it, and raises an error if it doesn’t exist." In the general, the PR I suggest brings these compose functions in line with the schema 3.4+ spec. In my specific case, I'm working through a series of dependencies to enable AWS ecs-cli to use a docker-compose file to mount volumes (EBS, S3FS,etc.) using the Rexray drivers. The issue you link is somewhat related. The direct issue is aws/amazon-ecs-cli#607 |
aws/amazon-ecs-cli#607 is interesting. IIUC the use of Otherwise, I repeat I'm +1 with the proposed change |
Glad to hear your +1. Create/destroy driver volumes every
|
Volume name must be unique in docker daemon whenever driver isn't the same. So your first sample is not valid (you can't have twice |
Only |
Hi. I think you are collapsing some things together. There is distinction between the following:
bullet 1 is defined by https://docs.docker.com/compose/compose-file/#external
bullet 2 is this PR. It corrects the errant implementation of the parser for compose 3.4+ You have jumped to bullet 4. How dockerd and docker.exe take values parsed out of a data doc. This is not the topic of this PR and I have no inquiry into this area. |
Hi @thaJeztah , checking back on your inquiry - or perhaps it is being triaged? |
Description
The compose parser in
/cli/compose/loader/
does not follow the compose 3.4+ schema rules as they apply to volumes that areexternal
and also declaredriver
,driver_opts
,labels
. Instead, the code only follows the rules that apply for schemas 3.0-3.3.Errant code has been isolated and trivial fix is ready.
Setup
loader.Load()
or the low-level errant functionloader.LoadVolumes()
.volumes:
that declares a volume with bothexternal:true
anddriver
,driver_opts
, orlabels
Repro
Result
Error.
conflicting parameters "external" and driver specified for volume myVol
Expected
No error. And to have a fully parsed Volume section.
Notes
The errant code is below. You can see the old 3.0-3.3 rules of mutual exclusion are being applied to all schema versions. The fix is to only apply them to versions 3.0-3.3 as per Docker documentation https://docs.docker.com/compose/compose-file/#external
cli/cli/compose/loader/loader.go
Lines 579 to 595 in 52714e4
This is related to old work that didn't implement the full set of rules for 3.4+. Issues #274 and #608
Trivial fix. I have a commit that I'm using which was based on the 18.09.5 release. Also trivial to apply to the 18.06 and 19.03 releases. Here is the fix diablodale@1d4c6d8
Happy to make three separate PRs with fixes and test cases for the three branches 18.06, 18.09, and 19.03.
The text was updated successfully, but these errors were encountered: