-
Notifications
You must be signed in to change notification settings - Fork 789
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
Secret src not working if env variable matches id #5282
Comments
@ashley-cui any thoughts? |
Might be a bug? I'll take a look |
A friendly reminder that this issue had no activity for 30 days. |
We have the same issue |
The default is always to consult an environment variable if one that matches the "id" or "src" value exists. In the command line option that specifies the file, you can add the (currently undocumented, but we'll fix that) "type=file" option to force a file to be read:
Or, as you would do in the "how do you remove a file named '-f' ?" case, you can alter the way the filename is specified by prepending a "./" if it's in the current directory, or using its full path, or any number of other things, so that it is no longer precisely the same as the name of an environment variable. |
@nalind I think a I don't understand why an |
I'm not sure I follow - when add "type=file" to the flag on a
It wouldn't have been my first choice, either, but that's the behavior that |
Oh, I didn't see it on the So I tried to create my error to see what I was running in to. Here's a Dockerfile for it: FROM ubuntu:latest
RUN --mount=type=secret,id=FOO \
echo $FOO && \
ls -al /run/secrets && \
echo -n"/run/secrets/FOO is: " && \
cat /run/secrets/FOO && \
echo "" And a local secret stored in a text file: Now if I run it without an environment variable set I get:
So based on that I think this is still an open issue. If I set
So as you can see the environment variable is not actually used. The file is empty instead. Oddly if I remove the
|
I must be missing the issue here - a secret, whether or not it comes from the environment, isn't exposed through the environment, but only through the named file, and the contents of the file containing the secret appear to be correct. Being able to change that looks like a new feature in dockerfile 1.10 that we don't support yet.
I am seeing the bug where it's still checking whether or not ${id} is set in the environment, instead of ${src}, when a "src" is specified, to determine whether to read a value from the environment or a file, and we're going to have to fix that. |
Sorry, I don't know how that ended up in the middle of my post. I'm sure I typed it at the end. I must have clicked accidentally. The bug you said you're seeing is the one that that that line was supposed to be directed at. The first example worked as I would have expected it to. |
Description
When building with a secret, that secret is empty if an environment variable exists with a name matching the id of the secret.
Steps to reproduce the issue:
Dockerfile
using a secretOutput of
rpm -q buildah
orapt list buildah
:Output of
buildah version
:Output of
podman version
if reporting apodman build
issue:Output of
cat /etc/*release
:Output of
uname -a
:Output of
cat /etc/containers/storage.conf
:The text was updated successfully, but these errors were encountered: