我正在使用Docker for windows的测试版
如果没有,那么为什么Windows可以运行linux容器而不是反之亦然?
编辑:
一段时间过去了,这个问题很受欢迎.我想在此添加一条说明,解决方法是使用新的netstandard.它允许我将4.6.2框架打包到新库中.
原始答案一般是正确的,但几个月前,docker增加了experimental feature LCOW(official github repository).
Doesn’t Docker for Windows already run Linux containers? That’s right.
Docker for Windows can run Linux or Windows containers,with support
for Linux containers via a Hyper-V Moby Linux VM (as of Docker for
Windows 17.10 this VM is based on LinuxKit).The setup for running Linux containers with LCOW is a lot simpler than
the prevIoUs architecture where a Hyper-V Linux VM runs a Linux Docker
daemon,along with all your containers. With LCOW,the Docker daemon
runs as a Windows process (same as when running Docker Windows
containers),and every time you start a Linux container Docker
launches a minimal Hyper-V hypervisor running a VM with a Linux
kernel,runc and the container processes running on top.Because there’s only one Docker daemon,and because that daemon now
runs on Windows,it will soon be possible to run Windows and Linux
Docker containers side-by-side,in the same networking namespace. This
will unlock a lot of exciting development and production scenarios for
Docker users on Windows.
原版的:
正如@PanagiotisKanavos的评论中所提到的,容器不是用于虚拟化,而是使用主机的资源.因此,目前windows容器无法在linux机器上“按原样”运行.
但是 – 你可以通过使用VM来实现 – 因为它适用于Windows.您可以在Linux主机上安装Windows VM,这将允许运行Windows容器.
有了它,恕我直言在PROD环境中以这种方式运行它将不是最好的主意.
此外,this answer提供了更多详细信息.