I’m trying to create a docker container that launches PowerShell and runs a .ps1 script which requires parameters. I changed my script to use environment variables $env:xxx, however I cannot figure out how to update the DockerFile so that these parameters can be passed in when the container is launched.
My DockerFile is as follows:
COPY MyScript.ps1 c:/MyFolder/
COPY Folder1 c:/MyFolder/Folder1
COPY Folder2 c:/MyFolder/Folder2
COPY TestApp c:/MyFolder/TestApp
CMD powershell c:/MyFolder/MyScript.ps1
Build and Run commands are as follows:
docker build --tag mycontainer . --build-arg Parameter1 --build-arg Parameter2
docker run -it mycontainer -e Parameter1=‘testp1’ -e Parameter2=‘testp2’
I’ve tried several variations from different posts online.
Any assistance would be greatly appreciated.