This is a request carried over from this issue - moby/buildkit#5445
Windows primarily gets the PATH environment variable from the registry. However, when the PATH is set in the image config, this will take precedence.
The problem arises with cases of installers and use of setx where the PATH in the registry is modified but the PATH in the config isn’t and the two copies slowly start diverging.
Linux on the other hand, has something that closely resembles what the registry hive does, where variables can be stored in file and loaded either manually or automatically when running the script. However, the advantage on the Linux end is that this PATH variable for instance gets merged basically by string interpolation. For instance if the PATH was set in the image:
ENV PATH="$PATH:/my/path"
And then if you have a script modifying the path:
export PATH=$PATH:/my/other/path
You end up having both /my/path and /my/other/path in the PATH.
NOTE: during container building, only the PATH set in the config is taken into consideration, unless you explicitly load the other PATH from script. If the PATH is set in say a .bashrc script, this will be automatically loaded when running in interactive bash shell.
The request: if Windows could consider (1) setting a default PATH config in the base images and (2) merging both PATH variable from config and registry during container run. For backward compatibility, this will need to be opt-in.
This is a request carried over from this issue - moby/buildkit#5445
Windows primarily gets the PATH environment variable from the registry. However, when the PATH is set in the image config, this will take precedence.
The problem arises with cases of installers and use of
setxwhere the PATH in the registry is modified but the PATH in the config isn’t and the two copies slowly start diverging.Linux on the other hand, has something that closely resembles what the registry hive does, where variables can be stored in file and loaded either manually or automatically when running the script. However, the advantage on the Linux end is that this PATH variable for instance gets merged basically by string interpolation. For instance if the PATH was set in the image:
ENV PATH="$PATH:/my/path"And then if you have a script modifying the path:
You end up having both
/my/pathand/my/other/pathin the PATH.The request: if Windows could consider (1) setting a default PATH config in the base images and (2) merging both PATH variable from config and registry during container run. For backward compatibility, this will need to be opt-in.