-
Notifications
You must be signed in to change notification settings - Fork 643
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
make it easy to supply environment variables to be passed to docker:run or docker:run-build from a properties file #128
Comments
you could probably accomplish this through the maven properties plugin and a build profile. the only drawback is you'd need to explicitly invoke the this is similar to #52. |
@jgangemi aha - great idea! :) I'll have an experiment with the maven properties plugin |
though it would be cleaner to allow this to just be configured on the docker:run configuration though; then it won't affect the generation of images etc |
configuring it to run as part of it's possible it could be treated like the assembly plugin and invoked directly though, i need to do more investigation. it's unfortunate maven doesn't provide a way to at least run the |
I think calling the However, allowing to specify an external properties file with environments variables to set when running a container has its charm, too. |
So, I played a little bit around this. I managed to populate maven project properties (using an other plugin) and then have the docker-maven-plugin use the "props" configuration handler. The only problem I see is that when using the external configuration handler the approach is all or nothing, meaning that it generates a new build and run configs using the project properties, without taking into consideration any configuration provided directly on the plugin. Would it make sense to use the existing configuration as a base and then use the external resolver for enriching / overriding the existing one? |
Yup, sounds good, but that's probably another story. I opened issue #136 for that. Here I think it's ok to add a
(hopefully the syntax restrictions for properties and env files are the same :). This should be possible to add quite easily. |
Added a configuration property I just pushed a fresh snapshot |
Build the integration branch locally and tried it out. Works great !!! |
when running things inside kubernetes there's a bunch of environment variables that get generated to describe the IP / ports where all the services are.
I raised this issue in fabric8 to make it easier to run docker images as if they were really inside a kubernetes environment: fabric8io/fabric8#3619 (comment)
to be able to do that it'd be nice if the docker-maven-plugin could have a canonical file somewhere in target (e.g. target/docker/environment.properties or something) thats either manually configured or defined by default - that it looks for to set/override environment variables when running a docker container.
Then folks can generate the env vars using other maven plugin (e.g. we can have a "mvn fabric8:env goal to generate the kubernetes environment variables into that file) and can then easily pass them into the docker image.
The text was updated successfully, but these errors were encountered: