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;
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;
You can use RUN.
You can RUN poweshell commands using
RUN powershell -Command Add-WindowsFeature Web-Server
Yes, there is another command. ENTRYPOINT ["executable", "param1", "param2"] is a command that, according to the documentation, will make the container to run the executable on its start. It can be used alongside with CMD.
I had a similar problem which I solved by using the shell directive.
FROM mcr.microsoft.com/windows/servercore:20H2 AS PS
SHELL ["powershell"]
RUN Write-Host "Hello from docker! Today is $(Get-Date)"
Edit: Just noticed the answer above has a bit better of a command than mine. Upvote it! https://stackoverflow.com/a/48804143/190831