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

docs: run mount secret env dockerfile example #5296

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

dvdksn
Copy link
Collaborator

@dvdksn dvdksn commented Sep 4, 2024

| ------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| `id` | ID of the secret. Defaults to basename of the target path. |
| `target`, `dst`, `destination` | Mount the secret to the specified path. Defaults to `/run/secrets/` + `id` if unset and if `env` is also unset. |
| `env` | Mount the secret to an environment variable instead of a file, or both. (since Dockerfile v1.10.0) |
Copy link
Member

Choose a reason for hiding this comment

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

Should we have a column with minimal version similar to #5275 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah thought about it. wdyt? Do you know when those other fields were added? :D

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK maybe a table will look silly in that case. That's kinda why I didn't do it immediately. I didn't know when any of the other opts were released, and having them all empty or say "1.0" is a bit weird.

Copy link
Member

Choose a reason for hiding this comment

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

Yes agree let's keep it like this for now

# syntax=docker/dockerfile:1
FROM alpine
RUN --mount=type=secret,id=API_KEY,env=API_KEY \
printenv API_KEY
Copy link
Member

Choose a reason for hiding this comment

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

Maybe not print the API_KEY, as it would be saved in the history record logs then 😉

Copy link
Collaborator Author

@dvdksn dvdksn Sep 5, 2024

Choose a reason for hiding this comment

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

I couldn't think of an example usage 😆 I can change it to some pseudo command

RUN --mount=type=secret,id=API_KEY,env=API_KEY \
    some-command --token-env API_KEY

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@crazy-max crazy-max merged commit 9a9029b into moby:master Sep 5, 2024
31 checks passed
@dvdksn dvdksn deleted the docs-runmount-secret-env branch September 5, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants