Docker Community Forums

Share and learn in the Docker community.

Is it possible to swap lower image layer for a new one?

One of my unresolved concerns about Docker is it’s requirement that the container and the host run the exact same version of Windows. I’ve read that this restriction is relaxed when launching a container in HyperV mode but realistically, a typical docker host (e.g. a AWS instance) will already itself be a VM and is therefore unable to spawn child HyperV-based VM. It just doesn’t work. I tried it. So I want to stick with basic Windows Containers.

With this in mind, please consider my current Windows 2016 host which is running version 10.0.14393.576. The Windows Core docker image is using the exact same version. I then add my app to that image and commit it as a new image called “myAppImg.” All is good.

Now, Microsoft comes out with a security patch which bumps the host up to 10.0.14393.693. Fortunately, there’s also a Windows Core docker image with that same version. I pull it in. Now… How do I tell docker to alter “myAppImg” so that it’s new parent image is the 693 version of Windows Core instead of the 576 version that it’s currently using?

You can just rebuild the image with docker build after doing docker pull microsoft/windowsservercore to ensure you have the latest version.

Interesting. Ok, I’ll investigate that, thank you.

On a side note. Why do so many docker commands have multiple names? For example, for building, would I use ‘docker build’ or 'Build-ContainerImage?" Or to start an image I could use ‘docker start’ or ‘Run-ContainerImage’ or ‘Invoke-ContainerImage’… Seems redundant. Are the commands identical?

The PowerShell commands are not native to Docker but are provided by the PowerShell for Docker package that’s built by Microsoft: https://github.com/Microsoft/Docker-PowerShell

Personally I use docker because that’ll work on Mac and Linux too, but if you really like PowerShell, the commandlets might be a good option.