I am trying to use the same docker image for several containers. The only difference between these containers is the connection string in my web.config. I know it’s possible to have build arguments when building the image but I want to do a string replace and Set-Content on docker create or run in order to use the same image. I have tried using entrypoint powershell -c “Get-Date | Set-Content C:/Program Files/App/web.config” just as a test but this is not working for me and appears to do nothing at all. Any help on the proper syntax or another method of solving this problem would be appreciated.
I was able to get it working the way I had hoped. Though I am still working out some details in the provisioning script, this is how I ended up getting the result I wanted from the docker side of things. I came to this result by trial and error and I wish I could find an explanation as to why I needed an entry point and why I couldn’t use the shell directive.
FROM microsoft/aspnet:3.5-windowsservercore-10.0.14393.1198
#The shell line needs to be removed and any RUN commands need to be immediately proceeded by ‘powershell’ eg RUN powershell ping google.com #SHELL [“powershell”, “-Command”, “$ErrorActionPreference = ‘Stop’; $ProgressPreference = ‘SilentlyContinue’;”]