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?

9
  • 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? Oct 4, 2018 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 4, 2018 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 4, 2018 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? Oct 4, 2018 at 17:49
  • I have a stack question with no replies to update the SSL Settings in IIS feature delegation stackoverflow.com/questions/52636408/… 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 4, 2018 at 19:49

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.