且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在AWS Windows Server环境中运行Docker?

更新时间:2023-02-22 20:23:59

您实际上不需要安装Docker for Windows(以前称为Docker Toolbox),以便在Windows上使用Docker服务器.

You don't actually need to install Docker for Windows (formerly known as the Docker Toolbox) in order to utilize Docker on Windows Server.

首先,重要的是要了解Windows Server 2016平台上有两种不同类型的容器:Windows容器和Hyper-V容器.

First, it's important to understand that there are two different types of containers on the Windows Server 2016 platform: Windows Containers and Hyper-V containers.

  • Windows容器-在Windows Server内核之上运行,此处未使用任何虚拟机
  • Hyper-V容器-虚拟机容器,每个容器都有自己的内核

在Hyper-V之上还有第三个选项运行,称为Windows上的Linux容器(LCOW),但由于您似乎特别在询问Windows容器,因此我们不会对此进行介绍.

There's also a third option that runs on top of Hyper-V called Linux Containers on Windows (LCOW), but we won't get into that, as it appears you're specifically asking about Windows containers.

以下是您可以查看的几个选项:

Here are a couple options you can look at:

如果您绝对需要在AWS上运行Windows Hyper-V容器,或者要在Windows的Docker上运行Linux容器,则可以设置i3.metal EC2实例类型,这是一个裸机实例.您可以将Windows Server 2016部署到i3.metal实例类型上,安装Hyper-V,然后安装Docker for Windows.这使您能够同时运行Linux容器(在Hyper-V Linux来宾下),Hyper-V容器和Windows容器.

If you absolutely need to run Windows Hyper-V containers on AWS, or want to run Linux containers with Docker for Windows, you can provision the i3.metal EC2 instance type, which is a bare metal instance. You can deploy Windows Server 2016 onto the i3.metal instance type, install Hyper-V, and install Docker for Windows. This will give you the ability to run both Linux containers (under a Hyper-V Linux guest), Hyper-V containers, and Windows containers.

Amazon提供了可用于部署EC2实例的Amazon Machine Image(AMI),其中包含对Amazon Elastic Container Service(ECS)的优化. ECS是一项基于云的群集服务,可让您跨EC2中运行的一组工作节点部署基于容器的应用程序.

Amazon provides an Amazon Machine Image (AMI) that you can deploy EC2 instances from, which contains optimizations for the Amazon Elastic Container Service (ECS). ECS is a cloud-based clustering service that enables you to deploy container-based applications across an array of worker nodes running in EC2.

通常,您将一起使用ECS和经ECS优化的AMI来构建生产规模的集群,以将您的应用程序部署到该集群上.

Generally you'll use ECS and the ECS-optimized AMI together to build a production-scale cluster to deploy your applications onto.

还有一个可用的"带有容器的Windows Server 2016 " AMI,它与ECS优化的AMI并不相同,但确实包括对在Windows Server 2016上运行Docker容器的支持.您要做的就是使用此AMI部署新的EC2实例,然后可以登录并开始发出Docker命令来启动Windows容器. 如果您是Windows容器的新手,那么此选项很可能是您最简单的选择.

There's also a "Windows Server 2016 with Containers" AMI available, which isn't the same as the ECS-optimized AMI, but does include support for running Docker containers on Windows Server 2016. All you have to do is deploy a new EC2 instance, using this AMI, and you can log into it and start issuing Docker commands to launch Windows containers. This option is most likely the easiest option for you, if you're new to Windows containers.