I try these below commands in dockerfile but it didnot run the script.so are there any other commands for running the ps script in dockerfile?
ADD Windowss.ps1 .
CMD powershell .\Windowss.ps1;
To run a PS1 script file, you can do something like this:
SHELL ["cmd", "/S", "/C"]
RUN powershell -noexit "& ""C:\Chocolatey\lib\chocolatey.0.10.8\tools\chocolateyInstall.ps1"""
You can also do:
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
WORKDIR C:\
RUN .\install_pfx.ps1
You can use RUN
.
You can RUN poweshell commands using
RUN powershell -Command Add-WindowsFeature Web-Server
Refer https://docs.microsoft.com/en-us/dotnet/standard/containerized-lifecycle-architecture/design-develop-containerized-apps/set-up-windows-containers-with-powershell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With