.net - 运行 Windows 应用程序的 Docker

标签 .net windows docker virtualization

我将 Docker 理解为一种容器化工具,具有一组有限的 API,因此与平台无关。我试图了解它对典型 Windows 开发的限制。例如,它是否将访问限制为仅写入文件系统(并因此排除了写入注册表的应用程序)?是否存在 Dock 不适合的复杂程度(但我又听说 MSSQL 将在 docker 上得到支持)?

最佳答案

注意:从那时起,您有“How to run lightweight Windows Containers on Windows 10 ”(2019 年 1 月,2 年多后),来自 Stefan Scherer .

确实指出,在 Windows 10 1809 上使用最新版本的 Docker Desktop (2.0.0.2+),您现在可以在进程隔离模式下运行 Windows 容器

In the past process isolation was only possible with Windows Server.
The Windows 10 operating system uses the same kernel, but with different settings.
With this pull request moby/moby PR 38000 that got merged into Docker 18.09.1 it is now possible to use it on Windows 10 as well.

  • You can start more Windows Containers on your machine as they consume less resources
  • Containers normally start faster than in hyperv isolation mode
  • You can "see" the isolated processes and what they are doing

Especially for developers this is a great enhancement, because you now can use tools like Task Manager, Process Monitor and others to inspect your container processes from the host

The only caveat using the process isolation mode is that the Windows base image that is used for a Docker image must match the kernel of your Windows 10 machine.

Open up a PowerShell terminal and start a Windows container with this command

docker run -d -p 8080:8080 --isolation=process chocolateyfest/appetizer:1.0.0

https://stefanscherer.github.io/content/images/2019/01/windows-10-process-isolation.png

As you can see in the screen shot you can see the node.exe process in the Task Manager.
If you have the Sysinternals Process Monitor installed you also can see what the containerized process is doing.

This is great when you create an own Docker image from your or a 3rd-party app and something doesn't work as expected or the exe file just doesn't want to start inside the container.

关于.net - 运行 Windows 应用程序的 Docker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40252434/

相关文章:

java - 接受 Commons CLI 风格参数的控制台应用程序的 Dockerfile

Docker - 主机上的代理容器端口

.net - 无法解决 .NET Core 和 .NET Framework 之间的项目依赖问题

.net - 如何配置 OpenFileDialog 来选择文件夹?

windows - xlsopen 在 Windows 10 Octave 4.0.3 中不起作用

windows - 用于在资源管理器中双击文件并在Windows Terminal中使用WSL应用程序(Neovim,Vim等)启动/运行该文件的脚本

docker - 如何自动化 Multi-Arch-Docker 镜像构建

c# - 线程非常快地获得 100% CPU

.net - 使用 Masterpage 在 ASP.Net 页面上进行 javascript 验证的最佳方法是什么?

.net - 如何首先从数据库 EF 模型向现有代码添加其他表?