I can create either a Windows Server container or a Hyper-V container just fine.
This will create and start a Windows Server container: docker run -d --name iis-svr1 mhb/iisaspdemo ping -t localhost
This will create and start a Hyper-V container: docker run -d --isolation=hyperv --name iis-hv-01 mhb/iisaspdemo ping -t localhost
If i then use the command: docker inspect and look for isolation tag in the output, it will say either Process (for Windows Server container) or HyperV for a Hyper-V container.
Is there any way of convert a existing Windows Server container to a Hyper-V container using docker and what command would I use.
/Michael Buchardt
The same container images can be used to launch in process or Hyper-V isolation as you mentioned, but you can’t change this at runtime. You would need to stop and start a new container instead.
HI Patrick
Which docker command would I use to start the container in hyper-v isolation mode after I have stopped the container?
Because I cannot use: docker run and docker exec does not include the --isolation flag.
/Michael Buchardt
Right now you would have to do something like this:
docker run ...
<exit container normally>
docker commit <id from exited container> <tag>
docker run --isolation=hyperv <tag>
It might be feasible to add --isolation
to docker start
if you don’t want to commit it to a new layer. If you want to suggest it please go ahead and file an issue at https://github.com/moby/moby/issues
Also, docker exec
only works on running containers, and --isolation
needs to be there when the container is started. By the time you exec, it’s too late to change isolation since it’s already running.
Hi Patrick
Thank you for your help. Using the docker commit command to create a new image (layer) works and I am now able to switch the isolation mode. I totally agree that it would make sense to add the –isolation switch to docker start or maybe to docker update so you do not have to create a new image every time you want to change isolation mode. I will suggest it at the url you provided. Thanks again for your help.
/Michael Buchardt