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

fix subpath in ServiceVolumeConfig#String #688

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

ndeloof
Copy link
Collaborator

@ndeloof ndeloof commented Sep 30, 2024

quick fix as subpath option is malformed

To be debated: as this option is actually not supported in the string format, why not just exclude it
or why don't we also include createHostPath then ? #inconsistency

@ndeloof ndeloof requested review from glours and jhrotko September 30, 2024 08:44
@ndeloof ndeloof changed the title don't include subpath in ServiceVolumeConfig#String fix subpath in ServiceVolumeConfig#String Sep 30, 2024
@ndeloof
Copy link
Collaborator Author

ndeloof commented Sep 30, 2024

As docker run -v rejects unknown bind options, maybe better just remove subpath from String, WDYT ?

$ docker run -v .:/foo:ro,subpath=test alpine true
docker: Error response from daemon: invalid mode: ro,subpath=test.

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Comment on lines -555 to -557
if s.Volume != nil && s.Volume.Subpath != "" {
options = append(options, s.Volume.Subpath)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, we have a warning in Compose to let the users know it won't be used?
What adding the warning here for all the other implementations?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, Docker Compose HAS to use the mount API when SubPath or CreateHostPath is set

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️ Ok I wasn't concentrated enough when doing my review

@@ -95,7 +95,7 @@ func populateFieldFromBuffer(char rune, buffer []rune, volume *types.ServiceVolu
if isBindOption(option) {
setBindOption(volume, option)
}
// ignore unknown options
// ignore unknown options FIXME why not report an error here?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would vote to add a message here since the engine error message becomes cryptic to the user since these modes are set by compose so the engine can do its thing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The engine has it's own parser for the bind string, which reject unknown options.
Docker Compose just must not send a bind string to engine when it can't translate into, but String can't return an error

@ndeloof ndeloof merged commit 2821e2c into compose-spec:main Sep 30, 2024
8 checks passed
@ndeloof ndeloof deleted the subpath branch September 30, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants