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
Proposal: ENVFILE instruction : Allow to create multiple environment variables from a file #7688
Comments
Tried the same thing with Fedora and same result |
@coolsvap Though being able to import envs from a file in a Dockerfile would be awesome and is already supported on |
we do this thing a lot using the
pattern that you'll find in a number of the supported images. At that point, we can construct variables from auto-exposed database link variables, source variables from files, and do any of those sort of things you're probably attempting. doing it with the entrypoint is more useful I find for setting up environment, since it doesn't get ignored if you override CMD. |
@wyaeld but I think this use case makes sense for long term, where image builders can easily build images with ENV variables generated on the fly with ENV instruction in dockerfile. also, can you give me an example dockerfile? I could not find any, I will try that as a workaround |
I think this is a good approach. ENV files should be kept in the context, but yeah, this is not a bad idea at all. Proposing a new verb though: either SOURCE or ENVFILE -Erik
|
|
I’m torn on that. SOURCE basically has no advantages over RUN other than it persists the environment. It might just be smarter to make RUN more powerful at that point.
|
@coolsvap https://github.com/docker-library/wordpress is an example of a Docker repo doing the entrypoint trick. |
@erikh I completely agree. I am using RUN to execute some commands which depend on the source file my application generates run-time. I would be more happy if we can make RUN more powerful to persist environment or temporarily use the environment config from some place. @wyaeld Thanks for the suggestion, let me try that out as a workaround for my current work. Being said that I believe we can use the ENTRYPOINT only once, am I correct? I am asking this since I have a next application which I want to automate with dockerfile which generates 2 source files, one for normal user and one for administrator, where the approach suggested by @erikh to make RUN more powerful could be very helpful. |
Hello! Mainly:
Then from there, patches/features like this can be re-thought. Hope you can understand. |
Use case: Allow ENV to import a file containing variables to be exported
Issue: I am currently trying to create a container image for my application which on its installation generates a text file with all the exports that are needed by it. This file can be sourced and used ahead to perform operations using the application.
Currently I am not able to source the file with RUN source filename, instead I have to do a ENV operation.
Please find the reference Dockerfile at [1] and its build output at [2]
I think the ENV instruction can be extended to have file as parameter.
[1] https://github.com/coolsvap/docker-source-issue/blob/master/Dockerfile
[2] https://registry.hub.docker.com/u/coolsvap/docker-source-issue/build_id/13901/code/blbeyqt8cekrqrngp8hbaqa/
The text was updated successfully, but these errors were encountered: