Reputation: 56
I have a docker image that ends with the following CMD:
CMD ["powershell", "c:\install\settings\install.ps1"]
or
CMD powershell c:\install\settings\install.ps1
It did not execute (or perhaps the volume is not mounted yet).
Settings are placed in a mounted volume, and it is started with:
docker run -d -p 80:80 --name openid --rm -v D:\settings\:c:\install\settings mydocker
If I run the command after starting the docker image:
docker exec openid powershell c:\install\settings\install.ps1
It runs fine.
Is there a way of doing this?
Or is there a better way of deploying an IIS website with webdeploy and custom SetParameters.xml
?
Upvotes: 2
Views: 3434
Reputation: 353
You can pass PS script to docker command as this:
CMD ["powershell .\\myscript.ps1"]
Upvotes: 0
Reputation: 1840
Try
# set up the shell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
CMD ["powershell", "c:\\\install\\\settings\\\install.ps1"]
In Windows, the backslash is the separator in file paths, so we have to escape it in Dockerfiles, otherwise it will be interpreted as a line continuation. File paths then have double backslashes \, and the single backslash is used for line continuation
from: https://blog.sixeyed.com/windows-dockerfiles-and-the-backtick-backslash-backlash/
Upvotes: 1
Reputation: 891
try this, might be a problem with the slash.
CMD ["powershell", "c:/install/settings/install.ps1"]
Upvotes: 0