microsoft / microsoft/Windows-Containers

Feature Request: Merge PATH env from both configs and registry hive

Open
#582 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement triage
Dominant language
PowerShell
Stars
551
Forks
76
PR merge metrics
No merged PRs in 30d

Description

This is a request carried over from this issue - https://github.com/moby/buildkit/issues/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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or code entry points are named in the issue. Start by locating the Windows container runtime path that combines image configuration with registry environment variables, then review the linked BuildKit issue for context. Done means an opt-in behavior that merges PATH values from both sources while preserving the existing default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
infrastructure, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.