Open apollo13 opened 3 months ago
So you would expect that each RUN line would have access to the secret environment variable.
@flouthoc @nalind WDYT?
@rhatdan Yes, that would be nice. To elaborate: I am trying to set environment variables for common package managers (like python's pip and npm) so that the container builds use our internal mirrors without having to manually add support for that inside the Containerfile (currently I have a build-arg ala: ARG PIP_PYPI_URL=https://pypi.org/simple
but that leaks into the container history if I override it from the outside -- unless I use it in an intermediate container in multi stage builds.).
I fully understand though if that stays only supported for podman run/create
. Nevertheless it would be really nice to have and might somewhat improve security as well.
Yes I think this is reasonable.
@ashley-cui WDYT?
@apollo13 I think --mount=type=secret
only exposes secret for a specific RUN
and not creates secret for entire container, it will expose it on the dst
path but will be transient in nature and you can manually export
it to your preferred env
variable.
Please feel free to close the issue if you think above should suffice your use-case.
@flouthoc Yes, that works, but requires cooperation from inside the docker file. With my proposed solution I could "enforce" a company wide pypi mirror (etc) without manually touching all the dockerfiles. Also the fallback is rather ugly if you mount something in RUN
it probably has to exist in some form.
I think setting the environment variable for the length of the RUN command would be a good idea.
A friendly reminder that this issue had no activity for 30 days.
Ideally I'd like to be able to set a transient env variable during a container build.
+1 I've run into a similar use case with podman build
in the context of a CI engine which is already making secrets available as environment variables. To get them into podman
, they first have to be written to files to be subsequently imported as secrets.
Issue Description
I am trying to pass some secret into a container build without leaving any traces in the container itself. Playing around I tried:
which complains:
So far so good, prefixing with
id=
successfully builds but doesn't expose the env to the container. The docs seem to suggest that this won't work anyways https://docs.podman.io/en/latest/markdown/podman-build.1.html#secret-id-id-src-path and apparently only supported forpodman run/create
: https://docs.podman.io/en/latest/markdown/podman-run.1.html#secret-secret-opt-optSo I am assuming that
podman build
uses the same "parsing logic" while not really supporting all of it.Ideally I'd like to be able to set a transient env variable during a container build.
Steps to reproduce the issue
Describe the results you received
$ASD
is empty inside the build contextDescribe the results you expected
I'd love to see the content of the secret
podman info output