How can I run Docker in a AWS Windows Server environment?

前端 未结 3 1456
星月不相逢
星月不相逢 2021-02-05 14:00

Thing I\'d tried:

Toolbox on Windows Server 2012 R2. Disabled Hyper-V to allow virtualbox. I cannot enable virtualization as it\'s on the physical bios.

Installed

相关标签:
3条回答
  • 2021-02-05 14:17

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

    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 Containers - runs on top of the Windows Server kernel, no virtual machines used here
    • Hyper-V Containers - virtual machine containers, each with their own kernel

    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:

    Bare Metal Instances on AWS

    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.

    ECS-Optimized AMI

    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.

    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 with Containers AMI

    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.

    0 讨论(0)
  • 2021-02-05 14:34

    EC2 instances do not allow for nested virtualization (EC2 instances are themselves virtual machines). Docker for Windows uses Hyper-V under the hood, and Docker Toolbox uses Virtualbox under the hood, so neither of those solutions are viable.

    Even if you were able to run them on a Windows EC2 instance, the performance wouldn't be that great due to the fact that Docker for Windows mounts files into the Docker VM via Samba, which is not very fast.

    If you want to run Linux containers, you should probably run them on Linux. It's very fast to get set up, and all of the Docker commands that you're used to with Docker for Windows should still work.

    0 讨论(0)
  • 2021-02-05 14:38

    It is possible to run docker on windows. Run the following command to set it up.

    docker-machine create --driver amazonec2 aws01
    

    What this command does is create a new EC2 linux instance, and connects up docker to that linux instance. When docker commands are run on your windows instance the docker commands actually are sent to the linux instance, executed, and the results are returned to the windows EC2 instance.

    Here's Docker's documentation on it. I hope this helps. https://docs.docker.com/machine/drivers/aws/#aws-credential-file

    0 讨论(0)
提交回复
热议问题