Skip to content

Support installing WinGet on Docker for Windows containers  #4144

Description

@JensNordenbro

Description of the new feature / enhancement

msix packages are not possible to install on Windows containers .

WinGet is an excellent means to acquire tools for containers.

Proposed technical implementation details

Provide a Windows Containers friendly package. xcopy - deployment zip for example.

Activity

  1. added
    Issue-Feature
    on Feb 6, 2024
  2. mdanish-kh commented on Feb 6, 2024

    @mdanish-kh
    Contributor
  3. JensNordenbro commented on Feb 6, 2024

    @JensNordenbro
    Author

    In a way the request is perhaps more about being able to install any msix, winget is just what is in front of me for the moment.

  4. removed
    Needs-Triage
    on Feb 6, 2024
  5. benh57 commented on Jan 23, 2025

    @benh57

    Would love to see this moved forward especially with server 2025 now including winget.

  6. lygstate commented on Aug 15, 2025

    @lygstate

    Is this a duplicated of #3037?

  7. JensNordenbro commented on Aug 15, 2025

    @JensNordenbro
    Author

    It is.

    Fix it * 2!

  8. benh57 commented on Aug 15, 2025

    @benh57

    The powershell process in #3037 is considered the official position by the project? That is ridiculous to close this for that. There should be a straightforward way to install winget in docker.

  9. JensNordenbro commented on Aug 16, 2025

    @JensNordenbro
    Author

    I just closed it to only have one copy open to make life easier to the devs (If there are any).

    I can reoopen of you want me to but please consider my logic first

  10. gerneio commented on Aug 16, 2025

    @gerneio

    JensNordenbro the other issue was closed a year ago.

  11. JensNordenbro commented on Aug 16, 2025

    @JensNordenbro
    Author

    Ohh, now I see your point.

  12. jankap commented on Oct 8, 2025

    @jankap

    I can install winget inside a container of mcr.microsoft.com/windows/server:ltsc2025 via (thanks to #3037 (comment))

    # Fail fast & no progress bars
        $ErrorActionPreference = 'Stop'
        $ProgressPreference = 'SilentlyContinue'
    
        # https://github.com/microsoft/winget-cli/issues/3037
        New-Item -Force -ItemType 'directory' -Name 'winget-cli' -Path 'C:/temp'
        Invoke-WebRequest 'https://aka.ms/vs/16/release/vc_redist.x64.exe' -OutFile 'C:/temp/vc_redist.x64.exe' -UseBasicParsing -Proxy $env:http_proxy
        powershell -c C:/temp/vc_redist.x64.exe /install /quiet /norestart
        Invoke-WebRequest 'https://aka.ms/getwinget' -OutFile 'C:/temp/winget-cli/winget.zip' -UseBasicParsing -Proxy $env:http_proxy
        echo "downloaded winget"
        Expand-Archive -LiteralPath 'C:/temp/winget-cli/winget.zip' -DestinationPath 'C:/temp/winget-cli' -Force
        echo "expanded archive"
        Move-Item -Path 'C:/temp/winget-cli/AppInstaller_x64.msix' -Destination 'C:/temp/winget-cli/AppInstaller_x64.zip'
        Expand-Archive -LiteralPath 'C:/temp/winget-cli/AppInstaller_x64.zip' -DestinationPath 'C:/temp/winget-cli' -Force
        New-Item -Force -ItemType 'directory' -Name 'winget-cli' -Path 'C:/'
        Move-Item -Path 'C:/temp/winget-cli/winget.exe' -Destination 'C:/winget-cli/winget.exe'
        Move-Item -Path 'C:/temp/winget-cli/WindowsPackageManager.dll' -Destination 'C:/winget-cli/WindowsPackageManager.dll'
        Move-Item -Path 'C:/temp/winget-cli/resources.pri' -Destination 'C:/winget-cli'
    
        echo "Adding winget to PATH (current session + machine)"
        $wingetDir = 'C:\winget-cli'
        # Persist:
        try {
          $machPath = [Environment]::GetEnvironmentVariable('Path','Machine')
          if ($machPath -notmatch [regex]::Escape($wingetDir)) {
            [Environment]::SetEnvironmentVariable('Path', "$machPath;$wingetDir", 'Machine')
          }
        } catch { }
    
        # Immediate use in this job:
        if ($env:Path -notmatch [regex]::Escape($wingetDir)) {
          $env:Path += ";$wingetDir"
        }
    
        echo "Install complete"
    
        # Verify
        winget --version
    

    You might have to adjust $env:http_proxy.

    and a version is shown:

    PS C:\> winget --version
    v1.11.510
    

    But I can't install anything:

    winget settings --enable ProxyCommandLineOptions
    
    winget source update --proxy $env:http_proxy
    Updating all sources...
    Updating source: msstore...
    Done
    Updating source: winget...
    Cancelled
    

    I haven't cancelled it - happend automatically.

    PS C:\> winget source list --proxy $env:http_proxy
    Name    Argument                                      Explicit
    --------------------------------------------------------------
    msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0 false
    winget  https://cdn.winget.microsoft.com/cache        false
    

    My proxy is not blocking the winget cache, because iwr https://cdn.winget.microsoft.com/cache/source.msix -Proxy $env:http_proxy -UseBasicParsing -OutFile source.msix works...

    I can even add the package, at least there's no error, but it doesn't change anything.

    PS C:\> Add-AppxPackage -Path .\source.msix
    PS C:\>
    

    Interestingly, msstore stuff seems to work, at least a search does work, whereas winget does not

    PS C:\> winget search git --proxy $env:http_proxy --verbose --source winget
    Failed when opening source(s); try the 'source reset' command if the problem persists.
    An unexpected error occurred while executing the command:
    0x8a15000f : Data required by the source is missing
    
    PS C:\> winget search git --proxy $env:http_proxy --verbose --source msstore
    Name      Id           Version
    ------------------------------
    My Git    9NLVK2SL2SSP Unknown
    GitFiend  9NMNKLTSZNKC Unknown
    GitLooker 9PK6TGX9T87P Unknown
    

    Of couese, I've reset the sources, but no change:

    PS C:\> winget source reset --force --proxy $env:http_proxy
    Resetting all sources...Done
    

    So long story short, is winget unusable on Windows Containers?

  13. manupillai308 commented on Jun 5, 2026

    @manupillai308

    To anyone who is facing the same issue, I was able to get it working:

    FROM mcr.microsoft.com/windows/server:ltsc2025
    
    # Install Visual C++ Redistributable (required by many native packages)
    WORKDIR C:\\Downloads
    ADD https://aka.ms/vs/16/release/vc_redist.x64.exe C:\\Downloads\\vcredist_x64.exe
    RUN C:\\Downloads\\vcredist_x64.exe /install /passive /norestart /log out.txt
    
    # Install winget from GitHub release
    ADD https://github.com/microsoft/winget-cli/releases/download/v1.29.250/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle C:\\Downloads\\winget.zip
    RUN powershell -Command \
        "Expand-Archive -Path C:\\Downloads\\winget.zip -DestinationPath C:\\Downloads\\winget_outer -Force; \
         Copy-Item C:\\Downloads\\winget_outer\\AppInstaller_x64.msix C:\\Downloads\\winget_x64.zip; \
         Expand-Archive -Path C:\\Downloads\\winget_x64.zip -DestinationPath C:\\winget -Force"
    RUN setx /M PATH "%PATH%;C:\winget"
    
    CMD ["powershell"]
    

    This works well for my usecase where I wanted to install a bunch of dependencies.
    My host version: Microsoft Windows [Version 10.0.26200.8457]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions