Documentation

Index GITLab

Runing a mcr.microsoft.com/powershell:lts-nanoserver-1809 in GITLab Docker runner with shell powershell

When you have a Gitlab Windows Docker runner with shell powershell configured, then your are not directly able to run images which contain the newer powershell pwsh.

Here is a hack to make a powershell available by creating a symbolic link to pwsh at container startup:

.nanoServerPowershell:
  image:
    name: mcr.microsoft.com/powershell:lts-nanoserver-1809
    docker:
      user: ContainerAdministrator # Required to create the symbolic link
    entrypoint:
      - "pwsh"
      - "-Command"
      # ";" at end of pwsh command required!
      - 'New-Item "$($Env:ProgramFiles)/Powershell/powershell.exe" -ItemType SymbolicLink -Target "$($Env:ProgramFiles)/Powershell/pwsh.exe" | Out-Null;'

© SphereSoft.NET, Holger Boskugel, Berlin, Germany spheresoft.net