适用于 Windows 的 Docker.io
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18854240/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Docker.io for Windows
提问by Jiri
I was reading a nice question about docker - answer has overview of docker implementation details. I was wondering if anything like this is possible to do on Windows platform.
我正在阅读一个关于 docker 的好问题 - answer 有关于docker 实现细节的概述。我想知道是否可以在 Windows 平台上做这样的事情。
- Do Windows alternatives for Docker exist?
- Is it theoretically possible to use other (Windows based) components to build it?
- 是否存在适用于 Docker 的 Windows 替代品?
- 理论上是否可以使用其他(基于 Windows 的)组件来构建它?
Update1:
更新1:
- Slightly related question (sandboxing): Is there a lightweight, programmable Sandbox API for the Windows platform?
- 稍微相关的问题(沙箱):是否有适用于 Windows 平台的轻量级、可编程的 Sandbox API?
Update2::
更新2::
For info how to install docker on windows (unrelated) - official docshas great instructions how to set up the environment by using boot2docker VM.
有关如何在 Windows 上安装 docker(无关)的信息 -官方文档有很好的说明如何使用 boot2docker VM 设置环境。
采纳答案by Alp
You can run docker in a virtual machine.
您可以在虚拟机中运行 docker。
New Update
新更新
Vagrant has now integrated docker support. It can be used as provider or as provisioner. Here are some useful links.
Vagrant 现在已经集成了 docker 支持。它可以用作提供者或提供者。这里有一些有用的链接。
Feature Preview: Docker-Based Development Environments
功能预览:基于 Docker 的开发环境
Vagrant Docs: Docker Provisioner
Vagrant 文档:Docker Provisioner
Vagrant Docs: Docker Provider
Vagrant 文档:Docker 提供者
Old Update
旧更新
As seanf pointed out in a comment below, Vagrant support was dropped. Instead they point to boot2docker:
正如 seanf 在下面的评论中指出的那样,Vagrant 的支持被放弃了。相反,他们指向boot2docker:
boot2docker is a lightweight Linux distribution based on Tiny Core Linux made specifically to run Docker containers. It runs completely from RAM, weighs ~24MB and boots in ~5s (YMMV).
boot2docker 是一个基于 Tiny Core Linux 的轻量级 Linux 发行版,专门用于运行 Docker 容器。它完全从 RAM 运行,重约 24MB 并在约 5 秒内启动(YMMV)。
Old answer
旧答案
The official docker documentation contains a small guide to install docker inside a Vagrant box. Vagrantis a great vm management wrapper. The guide is for Mac/Linux, but you get the idea to do the same in Windows:
官方 docker 文档包含一个在 Vagrant 盒子中安装 docker 的小指南。Vagrant是一个很棒的虚拟机管理包装器。该指南适用于 Mac/Linux,但您可以在 Windows 中执行相同操作:
http://docs.docker.io/en/latest/installation/vagrant/
http://docs.docker.io/en/latest/installation/vagrant/
This way you can share docker images across multiple systems with different operating systems.
通过这种方式,您可以在具有不同操作系统的多个系统之间共享 docker 镜像。
回答by sschuberth
If you're just searching for a way to deploy a pre-packaged set of applications in some sort of container for Windows, with registry and file access being virtualized but without using a full-blown virtual machine image, these (commercial) sandbox-like applications might be worth looking at:
如果您只是在寻找一种在 Windows 的某种容器中部署一组预先打包的应用程序的方法,虚拟化注册表和文件访问,但不使用成熟的虚拟机映像,这些(商业)沙箱 -像应用程序可能值得一看:
- Symantec Workspace Virtualization(get some ready-to-use packages from here)
- Evalaze
- Cameyo
- BoxedApp
- Symantec Workspace Virtualization(从这里获取一些现成的包)
- 评价
- 卡梅约
- 盒装应用
Edit:There's a new kid on the block, Spoon supports containers for Windows, and it actually looks very promising.
编辑:这个块上有一个新孩子,Spoon 支持 Windows 容器,它实际上看起来非常有前途。
回答by Jiri
I have found that at least file system related functionality has Windows (7,8) already in place. One can use VHD files (virtual disks) for handling "images" concept in Docker. These image are used for virtual machine but can be created/attached/used directly by Windows too:
我发现至少与文件系统相关的功能已经安装了 Windows (7,8)。可以使用 VHD 文件(虚拟磁盘)来处理 Docker 中的“图像”概念。这些映像用于虚拟机,但也可以由 Windows 直接创建/附加/使用:
diskpart
DISKPART> create vdisk file=c:\base-image.vhd maximum=200 type=expandable
New image can be layered on top of base image:
新图像可以叠加在基础图像之上:
DISKPART> create vdisk file=c:\image-2.vhd parent=c:\base-image.vhd
See more information about managing virtual disks.
查看有关管理虚拟磁盘的更多信息。
Unfortunately, process lightweight isolation/sandboxing is probably not possible (at least not simple), although some methods do exists (http://www.sandboxie.com/, Native Client in Google Chrome ...)
不幸的是,进程轻量级隔离/沙箱可能是不可能的(至少不简单),尽管确实存在一些方法(http://www.sandboxie.com/,GoogleChrome 中的 Native Client ...)
回答by Oskar Duveborn
Microsoft is working on their own Hyper-V Containerthat is similar to Docker - Azure also supports the Docker infrastructure.
微软正在开发自己的类似于 Docker的Hyper-V 容器——Azure 也支持 Docker 基础设施。
That aside, it's hard to give precise alternatives but on the Windows side we've had App-V for quite a long time which virtualises and sand-boxes applications so they can be run or streamed without being actually installed on a specific system. I've never meddled with it but it seems to be able to run as a standaloneclient without any need of the intricate server infrastructure usually involved for anything Microsoft.
除此之外,很难给出精确的替代方案,但在 Windows 方面,我们已经使用 App-V 很长时间了,它可以虚拟化和沙盒应用程序,因此它们可以在不实际安装在特定系统上的情况下运行或流式传输。我从来没有干预过它,但它似乎能够作为独立的客户端运行,而无需任何 Microsoft 通常涉及的复杂服务器基础结构。
From another perspective the disk image format used by Windows (VHD) supports standard differencing so you can easily run many virtual machines from a single read-only OS image where each virtual machine have a tiny write image to handle the differences. These are still fullblown virtual machines though.
从另一个角度来看,Windows (VHD) 使用的磁盘映像格式支持标准差异,因此您可以从单个只读操作系统映像轻松运行多个虚拟机,其中每个虚拟机都有一个很小的写入映像来处理差异。不过,这些仍然是成熟的虚拟机。
回答by Ken Cochrane
I currently don't know of any way to do the same thing on native windows as of right now.
我目前不知道有什么方法可以在本机 Windows 上做同样的事情。
I don't think the windows kernel was built for this sort of thing, so in order for it to be supported Microsoft would have to add the capabilities to the windows kernel. If I'm wrong, someone please correct me.
我不认为 Windows 内核是为这种事情而构建的,因此为了支持它,Microsoft 必须将这些功能添加到 Windows 内核中。如果我错了,请有人纠正我。
The most common way for people to do something like this is to use a VM in windows that runs a Linux based OS, and running everything inside of that. You could also do the same thing using FreeBSD (Jails), and Solaris (zones), if that is more your cup of tea. But Docker currently doesn't support FreeBSD or Solaris, so you will need to use the native tools for those.
人们执行此类操作的最常见方法是在运行基于 Linux 的操作系统的 Windows 中使用 VM,并在其中运行所有内容。您也可以使用 FreeBSD(监狱)和 Solaris(区域)来做同样的事情,如果这更适合您的话。但是 Docker 目前不支持 FreeBSD 或 Solaris,因此您需要使用原生工具。
回答by marengz
Now you can run docker natively on windows
现在您可以在 Windows 上本地运行 docker
See http://docs.master.dockerproject.com/installation/windows/
请参阅http://docs.master.dockerproject.com/installation/windows/
And
和
回答by Leon Adler
Starting in june 2016, Docker can be run on Microsoft's Hyper-V virtualization on Windows 10 hosts. This is now the preferred and "official" way to run Docker on Windows.
从 2016 年 6 月开始,Docker 可以在 Windows 10 主机上的 Microsoft Hyper-V 虚拟化上运行。这是现在在 Windows 上运行 Docker 的首选和“官方”方式。
https://docs.docker.com/engine/installation/windows/
https://docs.docker.com/engine/installation/windows/
Hyper-V is a Type-1-Hypervisor, meaning docker will run one layer closer to the host hardware and perform significantly faster than boot2docker (which uses VirtualBox, a Type-2-Hypervisor, running inside the host OS).
Hyper-V 是Type-1-Hypervisor,这意味着 docker 将运行更靠近主机硬件的一层,并且执行速度明显快于 boot2docker(它使用 VirtualBox,一个 Type-2-Hypervisor,在主机操作系统内部运行)。
The performance benefit for docker has a downside too: Enabling Hyper-V will prevent hardware virtualization features for Type-2-Hypervisors, therefore existing VirtualBox images can not be used with VTx, and you might want to consider moving other virtualized OSes to Hyper-V as well.
Docker 的性能优势也有一个缺点:启用 Hyper-V 将阻止 Type-2-Hypervisor 的硬件虚拟化功能,因此现有的 VirtualBox 映像不能与 VTx 一起使用,您可能需要考虑将其他虚拟化操作系统移至 Hyper- V也一样。
Windows 7-8.1 hosts can still use boot2docker to run Docker containers, but the main development focus for Docker on Windows is the "new" Hyper-V-Docker.
Windows 7-8.1 主机仍然可以使用 boot2docker 来运行 Docker 容器,但 Windows 上 Docker 的主要开发重点是“新”Hyper-V-Docker。
回答by danday74
Hyper-V is only on Windows Pro. Install it for £110.
Hyper-V 仅适用于 Windows Pro。安装它 £110。
Or simply install Vagrant, install VirtualBox, install GIT bash, then from your GIT bash terminal.
或者简单地安装 Vagrant,安装 VirtualBox,安装 GIT bash,然后从你的 GIT bash 终端。
git clone [email protected]:danday74/vagrant-docker-skelly.git
cd vagrant-docker-skelly
vagrant up # takes approx 5 mins to create VM
vagrant ssh
docker -v
docker-compose -v
The Vagrantfile shows that:
Vagrantfile 显示:
1 - this is a Xenial VM with docker and compose installed on it
1 - 这是一个带有 docker 的 Xenial VM 并在其上安装了 compose
2 - Ports mapped from Host to the VM are 9900-9920
2 - 从主机映射到 VM 的端口是 9900-9920
3 - The shared folder is shared from host to VM
3 - 共享文件夹从主机共享到虚拟机
Tweak this as desired.
根据需要调整它。
回答by Markus T
I got tired fighting with a maven docker plugin so I figured I would be able to fake it. This is how:
我厌倦了使用 Maven docker 插件,所以我想我可以伪造它。这是如何:
Using boot2docker and the following bat file makes it look like you're running docker natively. Place it on your path.
使用 boot2docker 和以下 bat 文件使您看起来像是在本地运行 docker。把它放在你的路上。
@set SSH="C:\Program Files (x86)\Git\bin\ssh.exe"
@set RUN_REMOTE='docker %*'
@ %SSH% -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -p 2022 -i %HOMEPATH%/.ssh/id_boot2docker -tt docker@localhost %RUN_REMOTE%
The ssh.exe comes from the msys-git package which is bundled with boot2docker. I'm pretty sure this solution have quite a few caveats, but it works pretty good for me. Place this file on your path and bob's yer uncle.
ssh.exe 来自与 boot2docker 捆绑在一起的 msys-git 包。我很确定这个解决方案有很多注意事项,但对我来说效果很好。将此文件放在您的路径和 bob 的叔叔上。