Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Preserve environment variables from the parent image on dockerTools.buildImage #87253
Motivation for this change
When building the Docker images with
This PR fetches the environment variables from the parent image and injects to the childs configuration. I also extended the NixOS tests to test this behaviour.
Still this is less than ideal, since the environment variables is not the only thing which should be inherited from the parents. Cmd, entrypoint, user, working directory, labels, volumes are also inherited, but unfortunately all in slightly different ways; and I think trying to replicate all that behavior will be costly. So, we can currently only handle environment variables and implement the others only when necessary.
Sorry @bjornfor , I missed that. You are right, it's almost the same with this one.
I read the discussion there, and I still think merging this PR is worthwhile. I guess that was the final decision on that PR anyway, just the author has lost interest.
Also, one thing worth mentioning is that the inheritance of other variables (volumes, labels etc) is not that simple, because as far as I can see there are subtle nuances between the way they are inherited (eg. moby/moby#5147). So, I think the proper solution would either:
So, in short I still think this PR is useful alone (as the original one).