0

Is it possible to pass docker file ARGS, to a pom file?

I have a docker file with ARG USER=foo and I wanted to use the argument from the dockerfile in a pom.xml with something similar to <username>${docker.args.USER}</username>. I only need them at run time for a build

risail
  • 509
  • 5
  • 14
  • 37

1 Answers1

0

Docker ARGs are added to your image as environment variables, so you should be able to load them in to your pom.xml in the same way as other environment variables.

From https://stackoverflow.com/a/10463133/2618764, it looks like you can use ${env.USER} to get what you need.

If that doesn't work for you, can you post your dockerfile and pom.xml?

TylerLubeck
  • 608
  • 4
  • 6