PowerShell in a dotNET container to be used in Linux OS. If you need PowerShell but without install.
459
The container is prepared with a Linux OS base image and the PowerShell also dotNet 8 prerequisites and installation is applied. This container can be used to test or run PowerShell on Linux OS without actually installing Powershell. The powershell commands can be run with the interactive mode of the container like:
docker run -it elektroxray/pownet:latest pwsh -c "Get-ChildItem /"
to test the execution of commands inside the container.
The container can be used as a simple sandbox to run all your powershell scripts and test them without touching the host Linux OS.
Create a folder preferably in your /home/username/Documents so you don't run in permission problems with the folder. The path will be something like: /home/username/Documents/powershellscripts
Save you powershell script inside the folder with a path like: /home/username/Documents/powershellscripts/testpowershell.ps1
Now you can run the container and attach the host folder to the /home folder inside the container using: -v /home/username/Documents/powershellscripts:/home
Also refer execution of pwsh with the path inside the container with: pwsh -c "/home/testpowershell.ps1"
using the Ubuntu jammy based image:
docker run -v /home/username/Documents/powershellscripts:/home pownet:jammy.dotnet8.v0.3 pwsh -c "/home/testpowershell.ps1"
or using the alpine based image that is somewhat more lightweight:
docker run -v /home/username/Documents/powershellscripts:/home pownet:alpine.dotnet8.v0.1 pwsh -c "/home/testpowershell.ps1"
Content type
Image
Digest
sha256:9a396e65d…
Size
391.4 MB
Last updated
over 1 year ago
docker pull elektroxray/pownet