如何在Windows 10上通过Docker获取Windows Server 16镜像?是否仅能在Server 16操作?
Absolutely, you can work with Windows Server 2016 Docker images on Windows 10—you don’t need a Windows Server 2016 host to do this. Let’s break down the requirements and step-by-step process to make this work smoothly.
Prerequisites
First, make sure your Windows 10 setup checks these boxes:
- You’re running Windows 10 Anniversary Update (version 1607) or later (this is the minimum version that supports Windows containers).
- You’ve enabled the Hyper-V and Containers Windows features (Docker Desktop relies on these to run Windows containers properly).
- You have Docker Desktop for Windows installed (stick to a recent stable version to avoid compatibility hiccups).
Step-by-Step Guide
Switch Docker to Windows Container mode
By default, Docker Desktop uses Linux containers. To switch over:- Right-click the Docker icon in your system tray.
- Select Switch to Windows containers and wait for the service to restart (this takes a minute or two).
Pull the official Windows Server 2016 image
Open PowerShell or Command Prompt and run this command to pull the official Windows Server Core 2016 base image (the most commonly used image for Server 2016 containers):docker pull mcr.microsoft.com/windows/servercore:ltsc2016The
ltsc2016tag maps directly to Windows Server 2016’s Long-Term Servicing Channel release.Confirm the image was pulled successfully
Check that the image is listed on your system with:docker imagesYou should see
mcr.microsoft.com/windows/servercorelisted alongside theltsc2016tag.Test running a Server 2016 container
Launch an interactive container to verify everything works as expected:docker run -it mcr.microsoft.com/windows/servercore:ltsc2016 cmdThis will drop you into a Command Prompt inside the container. Run
verto confirm the OS version—you’ll seeMicrosoft Windows [Version 10.0.14393], which is the kernel version for Windows Server 2016.
Key Notes
- Version compatibility: Windows containers share the host’s kernel, so your Windows 10 version needs to be compatible with the container OS. Windows 10 1607 matches exactly with Server 2016, but newer Windows 10 versions (like 1809+) can still run Server 2016 containers using compatibility mode (Docker handles this automatically in most cases).
- Troubleshooting: If you hit issues, double-check that Hyper-V is enabled correctly and that your Windows 10 edition supports it (Pro, Enterprise, or Education—Home edition requires a workaround to enable Hyper-V).
内容的提问来源于stack exchange,提问作者shankar upadhyay

