Setting env var matching tag name #1322
-
|
I'm actually pushing images using different tags to different registries. I would like to set an env var (or else) that matches actual image tag name so I can get it from inside container without the need to map docker socket. Is there a way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You could create a build arg for this purpose, placing it at the bottom of your Dockerfile: Then during build, you can set this with Unfortunately, to get the data, you will need to build multiple times - since this requires changing the runtime environment config, it can't be done without it. |
Beta Was this translation helpful? Give feedback.
You could create a build arg for this purpose, placing it at the bottom of your Dockerfile:
Then during build, you can set this with
--build-arg- because theARGcomes last, I think cache should be preserved between different runs ofbuild, so the subsequent builds should be almost instant (except for the time to push to the new registry).Unfortunately, to get the data, you will need to build multiple times - since this requires changing the runtime environment config, it can't be done without it.