Skip to content

dockerfile: allow setting file mode/uid for ssh and secrets#767

Merged
AkihiroSuda merged 2 commits intomoby:masterfrom
tonistiigi:dockerfile-uid-mode
Jan 4, 2019
Merged

dockerfile: allow setting file mode/uid for ssh and secrets#767
AkihiroSuda merged 2 commits intomoby:masterfrom
tonistiigi:dockerfile-uid-mode

Conversation

@tonistiigi
Copy link
Copy Markdown
Member

fixes #760 #763

@AkihiroSuda
Copy link
Copy Markdown
Member

Can we default to the user specified by the USER instruction, because RUN is expected to honor the USER instruction (unlike COPY/ADD)

@tonistiigi
Copy link
Copy Markdown
Member Author

It would be tricky as there is no support for such stateful operations directly in LLB and would need to do another request. Also, definition of user depends on the executor implementation. I'd rather skip uid/gid then and only expose mode.

|`target` | Mount path. Defaults to `/run/secrets/` + `id`.|
|`required` | If set to `true`, the instruction errors out when the secret is unavailable. Defaults to `false`.|
|`mode` | File mode for secret file in octal. Default 0400.|
|`uid` | User ID for secret file.|
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Default 0

Required bool
Mode *uint64
UID *uint64
GID *uint64
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just dropping by, but wondering: should these be *uint32 instead of *uint64 ? (I think Linux uses 32 bit for this)

In moby, looks like we're using int in some places (which may not be correct); https://github.com/moby/moby/blob/b3e9f7b13b0f0c414fa6253e1f17a86b2cff68b5/pkg/idtools/idtools.go#L105-L110

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is just to match the return type from parse. They are casted before actual use. I'll change the bitsize of the parse though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, thx, clear 👍

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi force-pushed the dockerfile-uid-mode branch from a1649b2 to b521aae Compare January 3, 2019 19:14
@tonistiigi
Copy link
Copy Markdown
Member Author

Updated.

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.

"RUN --mount=type=ssh" only accessible to root

3 participants