C#C
C#3y ago
Hejle

Docker - NanoServer - Dotnet with PowershellCore

I have created a DockerFile with Dotnet running in NanoServer, and got a bit annoyed at the CMD in there.
So I have spent hours trying to add PowerShellCore to it.

The closest, I think, is this post:
https://stackoverflow.com/questions/65104246/how-to-install-powershell-core-in-aspnet-nanoserver-docker-container
From there I have been look at this DockerFile:
https://github.com/PowerShell/PowerShell-Docker/blob/master/release/7-3/nanoserver2022/docker/Dockerfile

So, I have tried to run it with the DockerFile i have added.

Running this, my Container is created and everything works, but Powershell has not been added.
From the example in Github, the escapecharacter ` is used:
# escape=`
# Copyright (c) Microsoft Corporation.


But this fails with: "Syntax error - can't find = in "`". Must be of the form: name=value" so I have changed that to:

# escape=\
# Copyright (c) Microsoft Corporation.


My DockerFile can be seen here:
Was this page helpful?