-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
add support for build secrets #9386
Conversation
bind
API, use compose-go to (re)build volume stringSigned-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks @ndeloof to add this long-awaited feature
Thank you @ndeloof 🍻 When will it be available? In v2.5? |
Cheers 🍻!!! |
Any timeline this will be released ? Does this changes provide the ability to pass
I am using latest version 2.4.1 docker compose, it doesn't support CLI secret argument
|
Good to know. Please let me know when this feature will be released. |
Apparently this has just been released in v2.5.0 🎉 Looking at the pull request it seems it only implements the ability to add |
I think there are a few points missing:
|
secrets have to be defined by the
Not sure what you mean
This is tracked by compose-spec/compose-spec#251
both ssh and secret should be declared in |
If you have an ssh option on the build command, then it should have a secret option too, as is the case with docker build. Otherwise, it's inconsistent, IMO. This flag exists for compose build:
|
This isn't strictly consistent indeed. |
What is the usecase of all the other build options? Pretty much all of them have a respective setting in the yaml spec. |
I don't understand what you mean by "have a respective setting in the yaml spec". |
IMHO the whole idea of Compose is to have manifest file with all required stuff, which can be built and executed with bare minimum CLI commands. I don't see any sense of having So I agree with @ndeloof here 👍 |
that's indeed the root of the compose approach, but for usability some options still are exposed to the command line, so this is all about accepting some compromises and avoid getting all options exposed as flags "just because it's possible" |
I guess you are right. My points have been addressed and don't hold up. Back away slowly |
Is it possible to get this feature into v1? |
I have tested it and there are two issues I've noticed:
It also seems not to support loading secrets from an external source, but I guess this makes sense since external secrets may not be useful at build time... |
@smac89 Compose v1 is reaching end-of-life soon, we won't backport anything to this version and will only apply security fixes |
@glours I kinda figured that's the case, so I've gone ahead and made the switch to the compose plugin |
@ndeloof How does this feature work with intermediate (or multi-stage) builds ? I am using docker-compose v2.5.0 Edit : This does actually work. I configured incorrectly (thought file name would be same, however the file name is the secret's name in /run/secrets Thanks a lot! @ndeloof |
I tried using Docker Compose build secrets using the samples provided in the pull request but the secrets are not injected in the Dockerfile when I use What could be wrong? docker-compose.yml
Dockerfile
secret.txt
The output of
And the output of
|
@dotarj I believe you should just create new issue, instead of commenting PR merged more than a year ago 😉. |
@Wirone Yes, I fully agree. I'll create an issue for this. Thanks for the hint. 😉 |
@dotarj Did you manage to solve your issue and what is the issue that you created? I am having problems with trying to get my Dockerfile to 'see' the secrets defined in |
What I did
add support for build-time secrets.
also let compose-go (re)build volume string to be used by engine
bind
API when we can't usemount
Related issue
closes #6358
closes #9380
(not mandatory) A picture of a cute animal, if possible in relation with what you did