0

I am using Windows docker with a Windows container.

I am starting a container in interactive mode so that I can run some powershell scripts to enable remote iis management. I've tried to add these scripts to my dockerfile to incorporate them in the image, but they don't seem to stick unless I run them in powershell after the container is running.

I am starting the container with

docker run -it --rm --name mycontainer --entrypoint powershell myimage

Then if I try to commit it after making the changes I need, I get an error about not being able to commit a running container on windows. So I stop the container

docker stop mycontainer

And then when I look for the container to commit it is gone. I believe it is something to do with running it with the -it parameter.

Is there any way to get powershell access to the container, make changes, and then commit the container to a new image containing the changes I made?

Josh
  • 1,648
  • 8
  • 27
  • 58
  • Why are you trying to commit container? I don't beleive it's supported in Windows and even if it does what is the point? – Gregory Suvalian Oct 04 '18 at 15:07
  • I want to make changes to the container in IIS remote manager (these changes apparently can't be done through powershell) and then commit those so they persist as part of the image. – Josh Oct 04 '18 at 15:23
  • Seems docker has very limited usefulness if I can't even migrate an MVC app there because there is no way to update certain IIS settings. I was hoping there was some way to make the changes through a ui and persist them to the image somehow, so I figured out how to make the changes and get it working on a local container, but no way to make those changes available in my docker hub image? – Josh Oct 04 '18 at 15:30
  • Which settings you can not update in powershell? How are you planning to patch your image if you use `commit`? Are you going to redo this every month? – Gregory Suvalian Oct 04 '18 at 17:49
  • I have a stack question with no replies to update the SSL Settings in IIS feature delegation https://stackoverflow.com/questions/52636408/changing-iis-feature-delegation-for-ssl-settings-through-powershell What does it mean to patch my image? Was hoping to use the new image as the FROM in my dockerfile and have it generate a new container in my CI pipeline with the latest source code, then commit the new image and upload it to hub. – Josh Oct 04 '18 at 19:49
  • What do you inside image to fix it? You shall be able to do it as part of `DockerFile` why do you need to login and commit? – Gregory Suvalian Oct 04 '18 at 20:14
  • I setup remote iis management and use iis on the host computer to manage iis on the container and change the feature delegation setting. How would I do that in a dockerfile? My stack question from previous comment is asking how to do it in powershell and getting no answer. I've looked extensively through the powershell menus that hold other feature delegation settings and the one I need is nowhere to be seen. – Josh Oct 04 '18 at 20:26
  • I'm 100% sure it's possible to do in powershell. Try asking on iis.net forums – Gregory Suvalian Oct 04 '18 at 21:25
  • Ok posted https://forums.iis.net/p/1239581/2143720.aspx?p=True&t=636742623446045378 – Josh Oct 04 '18 at 22:06

1 Answers1

0

Finally found a way. Instead of creating container with -it -rm I now create it with just -d and use docker exec powershell to run the powershell commands. Then I can stop the container and commit it to an image and the new image contains all of the changes I made.

Josh
  • 1,648
  • 8
  • 27
  • 58