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

dockerfile: experimental ADD/COPY --chmod=... #1080

Closed
sj26 opened this issue Jul 16, 2019 · 2 comments
Closed

dockerfile: experimental ADD/COPY --chmod=... #1080

sj26 opened this issue Jul 16, 2019 · 2 comments

Comments

@sj26
Copy link

sj26 commented Jul 16, 2019

I know there's a rich history for adding an ADD/COPY --chmod=... flag similar to the --chown=... flag to the Dockerfile syntax, but I don't see a feature request here in this repo where it seems to belong — could we amend the Dockerfile experimental frontend syntax to add a --chmod=0755 style flag to ADD and COPY commands which populates the mode in the associated FileOp (from #809)? I'd be happy to prototype an implementation if there were appetite.

The main use case is building thin images by adding binaries directly from external sources which don't have a correct mode, like:

FROM scratch
ADD --chmod=0755 https://github.com/pganalyze/collector/releases/download/v0.21.0/pganalyze-collector-linux-amd64 /pganalyze-collector
COMMAND /pganalyze-collector

Currently, the only ways to really do this is download the file outside the Dockerfile, set modes, then copy it in, or to use an intermediate container with a whole lot of extra weight just to use a chmod command and then copy to a subsequent FROM scratch stage.

@sj26 sj26 changed the title dockerfile: experimental ADD/COPY chmod support dockerfile: experimental ADD/COPY --chmod=... Jul 16, 2019
@tonistiigi
Copy link
Member

could we amend the Dockerfile experimental frontend syntax to add a --chmod=0755 style flag to ADD and COPY commands which populates the mode in the associated FileOp (from #809)?

Yes, this is possible. No LLB/solver changes should be required.

@tonistiigi
Copy link
Member

#1492

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants