Skip to content

fix subpath in ServiceVolumeConfig#String#688

Merged
ndeloof merged 1 commit intocompose-spec:mainfrom
ndeloof:subpath
Sep 30, 2024
Merged

fix subpath in ServiceVolumeConfig#String#688
ndeloof merged 1 commit intocompose-spec:mainfrom
ndeloof:subpath

Conversation

@ndeloof
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

setBindOption(volume, option)
}
// ignore unknown options
// ignore unknown options FIXME why not report an error here?
Copy link
Copy Markdown
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
Copy Markdown
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

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