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

Inconsistencies in RUN mount options parsing/handling #4912

Open
TyIsI opened this issue May 10, 2024 · 1 comment
Open

Inconsistencies in RUN mount options parsing/handling #4912

TyIsI opened this issue May 10, 2024 · 1 comment

Comments

@TyIsI
Copy link

TyIsI commented May 10, 2024

While working on a JS/TS Dockerfile generator, I came across some inconsistencies in how the RUN mount options are being parsed/handled.

I just opened an issue for the documentation, but checking the sources, it looks like this might be more source related.

Examples:

## Works with all options that are not listed as supported
RUN --mount=type=tmpfs,target=/cache,size=1024,ro,readonly,rw,readwrite /bin/ls -asl /cache
## Not listed as supported, but pulls from registry
## ERROR [internal] load metadata for docker.io/library/nonexistent:latest
RUN --mount=type=tmpfs,target=/cache,size=1024,from=nonexistent /bin/ls -asl /cache
## Shows directories in root, documentation says from=<stage>, but happily loads image
RUN --mount=type=cache,target=/cache,from=alpine:3,source=/ /bin/ls -asl /cache

I'm not sure if I'm proficient enough in Go to actually come up with a good solution for this and I couldn't find any specs for what the correct behaviour should be, but I believe that the problem lies in parseMount in commands_runmount.go

Happy weekend!

@tonistiigi
Copy link
Member

documentation says from=, but happily loads image

from= takes the same argument as FROM <base> or COPY --from=<stage>. It can be named build context, named stage or image name, in that order or preference.

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

No branches or pull requests

2 participants