|
1 | 1 | # Setup
|
2 | 2 |
|
3 |
| -This chapter explores setting up a Windows environment to properly use Windows containers. There are three options for running Windows containers: |
| 3 | +There are four environments you can use to set-up Windows Containers. We have provided separate guides for each: |
4 | 4 |
|
5 |
| -+ Windows 10 with the Anniversary Update |
6 |
| -+ Windows Server 2016 on Azure |
7 |
| -+ Windows Server 2016 on bare metal or in VM |
8 |
| - |
9 |
| -## Windows 10 with Anniversary Update |
10 |
| - |
11 |
| -For developers, Windows 10 is a great place to run Docker Windows containers and containerization support was added to the the Windows 10 kernel with the [Anniversary Update](https://blogs.windows.com/windowsexperience/2016/08/02/how-to-get-the-windows-10-anniversary-update/) (note that container images can only be based on Windows Server Core and Nanoserver, not Windows 10). All that’s missing is the Windows-native Docker Engine and some image base layers. |
12 |
| - |
13 |
| -The simplest way to get a Windows Docker Engine is by installing the [Docker for Windows](https://docs.docker.com/docker-for-windows/ "Docker for Windows") public beta ([direct download link](https://download.docker.com/win/beta/InstallDocker.msi)). Docker for Windows used to only setup a Linux-based Docker development environment, but the public beta version now sets up both Linux and Windows Docker development environments, and we’re working on improving Windows container support and Linux/Windows container interoperability. |
14 |
| - |
15 |
| -With the public beta installed, the Docker for Windows tray icon has an option to switch between Linux and Windows container development. |
16 |
| - |
17 |
| - |
18 |
| - |
19 |
| -Switch to Windows containers and skip the next sections. |
20 |
| - |
21 |
| -## Windows Server 2016 on Azure |
22 |
| - |
23 |
| -Microsoft Azure has a pre-baked VM image with Docker engine and base images pre-loaded. To get started (requires Azure account): |
24 |
| - |
25 |
| - 1. Create a [Windows Server 2016 Datacenter - with Containers](https://azure.microsoft.com/en-us/marketplace/partners/microsoft/windowsserver2016datacenterwithcontainers/) VM. This VM image has Docker pre-installed and the Windows base layers pre-loaded. |
26 |
| - 2. Select "Classic" deployment model and hit "Create" |
27 |
| - 3. Input setup parameters |
28 |
| - - Default settings are good |
29 |
| - - Creating a new resource group is fine |
30 |
| - - `DS2_V2` instance type has good performance for development and testing |
31 |
| - 4. Check the Summary and hit "OK". Setup will take a couple of minutes |
32 |
| - 5. Once the VM is running, select "Connect" to open a remote desktop connection. If using macOS, get the free [Remote Desktop app in the Mac App Store](https://itunes.apple.com/us/app/microsoft-remote-desktop/id715768417?mt=12) |
33 |
| - 6. Login with the username and password configured during setup |
34 |
| - 7. Start PowerShell |
35 |
| - 8. `Start-Service docker` |
36 |
| - 9. Check that Docker is running with `docker version` |
37 |
| - |
38 |
| - |
39 |
| - |
40 |
| - |
41 |
| - |
42 |
| -## Windows Server 2016 on AWS |
43 |
| - |
44 |
| -AWS has a pre-baked AMI with Docker Engine already installed. To start an instance, do the following (requires AWS account): |
45 |
| - |
46 |
| -1. Open the [EC2 launch-instance wizard](https://us-west-1.console.aws.amazon.com/ec2/v2/home#LaunchInstanceWizard) |
47 |
| -2. Select the "Microsoft Windows Server 2016 Base with Containers" AMI |
48 |
| -3. Input setup parameters |
49 |
| - - `c4.large` has good performance for development and testing |
50 |
| - - The default AWS security group settings will let you connect with Remote Desktop |
51 |
| -4. Select "Review and Launch" |
52 |
| -5. Once the VM is up, hit "Connect". If using macOS, get the free [Remote Desktop app in the Mac App Store](https://itunes.apple.com/us/app/microsoft-remote-desktop/id715768417?mt=12) |
53 |
| -6. See details on [getting the initial Windows Administrator password for your AWS instance](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/connecting_to_windows_instance.html) |
54 |
| -7. Start PowerShell |
55 |
| -8. Check that Docker is running with `docker version` |
56 |
| - |
57 |
| - |
58 |
| - |
59 |
| -## Windows Server 2016 on bare metal or in VM |
60 |
| - |
61 |
| -Windows Server 2016 is where Docker Windows containers should be deployed for production. For developers planning to do lots of Docker Windows container development, it may also be worth setting up a Windows Server 2016 dev system (in a VM, for example), at least until Windows 10 and Docker for Windows support for Windows containers matures. Running a VM with Windows Server 2016 is also a great way to do Docker Windows container development on macOS and older Windows versions. |
62 |
| - |
63 |
| -Once Windows Server 2016 is running, log in, run Windows Update (use `sconfig` on Windows Server Core) to ensure all the latest updates are installed and install the Windows-native Docker Engine (that is, don't use "Docker for Windows"). There are two options: Install using a Powershell Package (recommended) or with DSC. |
64 |
| - |
65 |
| -### PowerShell Package Provider (recommended) |
66 |
| - |
67 |
| -Microsoft maintains a [PowerShell package provider](https://www.powershellgallery.com/packages/DockerMsftProvider) that lets easily install Docker on Windows Server 2016. |
68 |
| - |
69 |
| -Run the following in an Administrative PowerShell prompt: |
70 |
| - |
71 |
| -``` |
72 |
| -Install-Module -Name DockerMsftProvider -Force |
73 |
| -Install-Package -Name docker -ProviderName DockerMsftProvider -Force |
74 |
| -Restart-Computer -Force |
75 |
| -``` |
76 |
| - |
77 |
| -### PowerShell Desired State Configuration |
78 |
| - |
79 |
| -If interested in experimenting with [Windows PowerShell Desired State Configuration](https://msdn.microsoft.com/en-us/powershell/dsc/overview), Daniel Scott-Raynsford has built a [prototype script that uses DSC to install Docker Engine](https://www.powershellgallery.com/packages/Install-DockerOnWS2016UsingDSC/1.0.1/DisplayScript). |
80 |
| - |
81 |
| -Here's how to use it: |
82 |
| - |
83 |
| -``` |
84 |
| -Install-Script -Name Install-DockerOnWS2016UsingDSC |
85 |
| -Install-DockerOnWS2016UsingDSC.ps1 |
86 |
| -``` |
87 |
| - |
88 |
| -See Daniel's blog post for [details on installing Docker with DCS](https://dscottraynsford.wordpress.com/2016/10/15/install-docker-on-windows-server-2016-using-dsc/). |
89 |
| - |
90 |
| -Whether using the PowerShell Package Provider or DSC, Docker Engine is now running as a Windows service, listening on the default Docker named pipe. |
91 |
| - |
92 |
| -For development VMs running (for example) in a Hyper-V VM on Windows 10, it might be advantageous to make the Docker Engine running in the Windows Server 2016 VM available to the Windows 10 host: |
93 |
| - |
94 |
| - # Open firewall port 2375 |
95 |
| - netsh advfirewall firewall add rule name="docker engine" dir=in action=allow protocol=TCP localport=2375 |
96 |
| - |
97 |
| - # Configure Docker daemon to listen on both pipe and TCP (replaces docker --register-service invocation above) |
98 |
| - Stop-Service docker |
99 |
| - dockerd --unregister-service |
100 |
| - dockerd -H npipe:// -H 0.0.0.0:2375 --register-service |
101 |
| - Start-Service docker |
102 |
| - |
103 |
| -The Windows Server 2016 Docker engine can now be used from the VM host by setting `DOCKER_HOST`: |
104 |
| -`$env:DOCKER_HOST = "<ip-address-of-vm>:2375"` |
| 5 | ++ [Windows 10 with the Anniversary Update](Setup-Win10.md "Windows 10 Setup") |
| 6 | ++ [Windows Server 2016 on Azure](Setup-Azure.md "MS Azure Setup") |
| 7 | ++ [Windows Server 2016 on AWS](Setup-AWS.md "AWS Setup") |
| 8 | ++ [Windows Server 2016 on bare metal or in VM](Setup-Server2016.md "Setup on Windows 2016") |
105 | 9 |
|
106 | 10 | # Next Steps
|
107 | 11 | See the [Microsoft documentation for more comprehensive instructions](https://msdn.microsoft.com/virtualization/windowscontainers/containers_welcome "Microsoft documentation").
|
108 | 12 |
|
109 |
| -Continue to Step 2: [Getting Started with Windows Containers](WindowsContainers.md "Getting Started with Windows Containers") |
| 13 | +After you have completed setup, you can continue to Step 2: [Getting Started with Windows Containers](WindowsContainers.md "Getting Started with Windows Containers") |
0 commit comments