Windows nanoserver github portable (ssh auth) fatal: Could not read from remote repository

This page summarizes the projects mentioned and recommended in the original post on /r/docker

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • git

    A fork of Git containing Windows-specific patches. (by git-for-windows)

  • PowerShell

    PowerShell for every system!

  • # escape=` # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # Args used by from statements must be defined here: ARG InstallerEnvHost=mcr.microsoft.com ARG InstallerEnvRepo=windows/servercore ARG InstallerEnvTag=ltsc2022 ARG NanoEnvHost=mcr.microsoft.com ARG NanoEnvRepo=windows/nanoserver ARG NanoEnvTag=ltsc2022 # -------------------------------------------------------------------------------------------------------------------------------------- # STAGE 1 Build Environment # -------------------------------------------------------------------------------------------------------------------------------------- FROM ${InstallerEnvHost}/${InstallerEnvRepo}:$InstallerEnvTag AS installer-env1 # disable telemetry ENV POWERSHELL_TELEMETRY_OPTOUT="1" ARG PS_VERSION=7.3.2 ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip ARG ZIP_VERSION=2201 ARG ZIP_PACKAGE_URL=https://www.7-zip.org/a/7z$ZIP_VERSION-x64.exe SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; ` New-Item -ItemType Directory -Path C:\installer | Out-Null; ` Write-Output "Download PowerShell from $env:PS_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:PS_PACKAGE_URL -outfile C:\installer\powershell.zip -verbose; ` Expand-Archive C:\installer\powershell.zip -DestinationPath \PowerShell; ` Write-Output "Download 7-Zip from $env:ZIP_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:ZIP_PACKAGE_URL -OutFile C:\installer\7z.exe; ` Start-Process -FilePath C:\installer\7z.exe -ArgumentList '/S' -NoNewWindow -Wait -Verbose #Start the NanoServer Build of ePledge # -------------------------------------------------------------------------------------------------------------------------------------- # STAGE 2 Build Environment # -------------------------------------------------------------------------------------------------------------------------------------- FROM ${NanoEnvHost}/${NanoEnvRepo}:$NanoEnvTag AS installer-env2 COPY --from=installer-env1 ["/PowerShell", "/Program Files/PowerShell"] COPY --from=installer-env1 ["/Program Files/7-Zip", "/Program Files/7-Zip"] #Need to switch user to ContainerAdministrator in order to do a setx USER ContainerAdministrator RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell;%ProgramFiles%\Git\cmd;%ProgramFiles%\Git\usr\bin;%ProgramFiles%\7-zip" /M USER ContainerUser ARG GIT_VERSION=2.39.2 ARG GIT_PACKAGE_URL=https://github.com/git-for-windows/git/releases/download/v$GIT_VERSION.windows.1/PortableGit-$GIT_VERSION-64-bit.7z.exe ARG GH_CLI_VERSION=2.23.0 ARG GH_CLI_PACKAGE_URL=https://github.com/cli/cli/releases/download/v$GH_CLI_VERSION/gh_${GH_CLI_VERSION}_windows_amd64.zip SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; ` New-Item -ItemType Directory -Path C:\installer | Out-Null; ` Write-Output "Download Git from $env:GIT_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:GIT_PACKAGE_URL -OutFile C:\Installer\Git.7z.exe; ` 7z x C:\Installer\Git.7z.exe -ogit; ` Write-Output "Download Git CLI from $env:GH_CLI_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:GH_CLI_PACKAGE_URL -OutFile C:\Installer\GHCLI.zip; ` 7z x C:\Installer\GHCLI.zip -ogit # -------------------------------------------------------------------------------------------------------------------------------------- # Final Build STAGE # -------------------------------------------------------------------------------------------------------------------------------------- FROM ${NanoEnvHost}/${NanoEnvRepo}:$NanoEnvTag AS nanoserver-git COPY --from=installer-env1 ["/PowerShell", "/Program Files/PowerShell"] COPY --from=installer-env1 ["/Program Files/7-Zip", "/Program Files/7-Zip"] COPY --from=installer-env2 ["/Git", "/Program Files/Git"] USER ContainerAdministrator RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell;;%ProgramFiles%\Git;%ProgramFiles%\Git\cmd;%ProgramFiles%\Git\usr\bin;%ProgramFiles%\7-zip" /M USER ContainerUser SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] #Create Base Level Directories RUN New-Item -ItemType Directory -Path C:\AdminScripts | Out-Null; ` New-Item -ItemType Directory -Path C:\AdminScripts\epledge-deploy | Out-Null; ` New-Item -ItemType Directory -Path C:\Users\ContainerUser\.ssh | Out-Null; ` Set-Location $ENV:ProgramFiles\Git # Copy Over Files & Folders COPY IdentityFiles C:/AdminScripts/IdentityFiles COPY .ssh C:/Users/ContainerUser/.ssh RUN git config --global core.sshCommand 'ssh -o StrictHostKeyChecking=no' CMD ["pwsh.exe"]

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • cli

    GitHub’s official command line tool

  • # escape=` # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # Args used by from statements must be defined here: ARG InstallerEnvHost=mcr.microsoft.com ARG InstallerEnvRepo=windows/servercore ARG InstallerEnvTag=ltsc2022 ARG NanoEnvHost=mcr.microsoft.com ARG NanoEnvRepo=windows/nanoserver ARG NanoEnvTag=ltsc2022 # -------------------------------------------------------------------------------------------------------------------------------------- # STAGE 1 Build Environment # -------------------------------------------------------------------------------------------------------------------------------------- FROM ${InstallerEnvHost}/${InstallerEnvRepo}:$InstallerEnvTag AS installer-env1 # disable telemetry ENV POWERSHELL_TELEMETRY_OPTOUT="1" ARG PS_VERSION=7.3.2 ARG PS_PACKAGE_URL=https://github.com/PowerShell/PowerShell/releases/download/v$PS_VERSION/PowerShell-$PS_VERSION-win-x64.zip ARG ZIP_VERSION=2201 ARG ZIP_PACKAGE_URL=https://www.7-zip.org/a/7z$ZIP_VERSION-x64.exe SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; ` New-Item -ItemType Directory -Path C:\installer | Out-Null; ` Write-Output "Download PowerShell from $env:PS_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:PS_PACKAGE_URL -outfile C:\installer\powershell.zip -verbose; ` Expand-Archive C:\installer\powershell.zip -DestinationPath \PowerShell; ` Write-Output "Download 7-Zip from $env:ZIP_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:ZIP_PACKAGE_URL -OutFile C:\installer\7z.exe; ` Start-Process -FilePath C:\installer\7z.exe -ArgumentList '/S' -NoNewWindow -Wait -Verbose #Start the NanoServer Build of ePledge # -------------------------------------------------------------------------------------------------------------------------------------- # STAGE 2 Build Environment # -------------------------------------------------------------------------------------------------------------------------------------- FROM ${NanoEnvHost}/${NanoEnvRepo}:$NanoEnvTag AS installer-env2 COPY --from=installer-env1 ["/PowerShell", "/Program Files/PowerShell"] COPY --from=installer-env1 ["/Program Files/7-Zip", "/Program Files/7-Zip"] #Need to switch user to ContainerAdministrator in order to do a setx USER ContainerAdministrator RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell;%ProgramFiles%\Git\cmd;%ProgramFiles%\Git\usr\bin;%ProgramFiles%\7-zip" /M USER ContainerUser ARG GIT_VERSION=2.39.2 ARG GIT_PACKAGE_URL=https://github.com/git-for-windows/git/releases/download/v$GIT_VERSION.windows.1/PortableGit-$GIT_VERSION-64-bit.7z.exe ARG GH_CLI_VERSION=2.23.0 ARG GH_CLI_PACKAGE_URL=https://github.com/cli/cli/releases/download/v$GH_CLI_VERSION/gh_${GH_CLI_VERSION}_windows_amd64.zip SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] RUN [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; ` New-Item -ItemType Directory -Path C:\installer | Out-Null; ` Write-Output "Download Git from $env:GIT_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:GIT_PACKAGE_URL -OutFile C:\Installer\Git.7z.exe; ` 7z x C:\Installer\Git.7z.exe -ogit; ` Write-Output "Download Git CLI from $env:GH_CLI_PACKAGE_URL"; ` Invoke-WebRequest -Uri $env:GH_CLI_PACKAGE_URL -OutFile C:\Installer\GHCLI.zip; ` 7z x C:\Installer\GHCLI.zip -ogit # -------------------------------------------------------------------------------------------------------------------------------------- # Final Build STAGE # -------------------------------------------------------------------------------------------------------------------------------------- FROM ${NanoEnvHost}/${NanoEnvRepo}:$NanoEnvTag AS nanoserver-git COPY --from=installer-env1 ["/PowerShell", "/Program Files/PowerShell"] COPY --from=installer-env1 ["/Program Files/7-Zip", "/Program Files/7-Zip"] COPY --from=installer-env2 ["/Git", "/Program Files/Git"] USER ContainerAdministrator RUN setx PATH "%PATH%;%ProgramFiles%\PowerShell;;%ProgramFiles%\Git;%ProgramFiles%\Git\cmd;%ProgramFiles%\Git\usr\bin;%ProgramFiles%\7-zip" /M USER ContainerUser SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] #Create Base Level Directories RUN New-Item -ItemType Directory -Path C:\AdminScripts | Out-Null; ` New-Item -ItemType Directory -Path C:\AdminScripts\epledge-deploy | Out-Null; ` New-Item -ItemType Directory -Path C:\Users\ContainerUser\.ssh | Out-Null; ` Set-Location $ENV:ProgramFiles\Git # Copy Over Files & Folders COPY IdentityFiles C:/AdminScripts/IdentityFiles COPY .ssh C:/Users/ContainerUser/.ssh RUN git config --global core.sshCommand 'ssh -o StrictHostKeyChecking=no' CMD ["pwsh.exe"]

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts