Skip to content

Commit 3349f84

Browse files
friismMano Marks
authored and
Mano Marks
committed
Add azure option (docker#86)
* clean up after Mano * add sconfig note * superflous whitespace * normalize formatting * Add Azure option, and more cleanup
1 parent 307e6ed commit 3349f84

File tree

3 files changed

+53
-27
lines changed

3 files changed

+53
-27
lines changed

windows/windows-containers/Setup.md

+53-27
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
## Setup
2-
This chapter explores setting up your Windows environment to properly use Windows containers. You have two choices for environment at this point.
1+
# Setup
2+
3+
This chapter explores setting up a Windows environment to properly use Windows containers. There are three options for running Windows containers:
34

45
+ Windows 10 with the Anniversary Update
5-
+ Windows Server 2016
6+
+ Windows Server 2016 on Azure
7+
+ Windows Server 2016 on bare metal or in VM
68

7-
### Windows 10 with Anniversary Update
9+
## Windows 10 with Anniversary Update
810

911
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.
1012

@@ -14,50 +16,74 @@ With the public beta installed, the Docker for Windows tray icon has an option t
1416

1517
![Image of switching between Linux and Windows development environments](images/docker-for-windows-switch.gif "Image of switching between Linux and Windows development environments")
1618

17-
Switch to Windows containers and skip the next section.
19+
Switch to Windows containers and skip the next sections.
1820

21+
## Windows Server 2016 on Azure
1922

20-
### Windows Server 2016
23+
It's very easy to setup a fully configured Microsoft Azure VM with Docker Engine running, and base images pre-loaded:
2124

22-
Windows Server 2016 is the 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.
25+
1. Create a [Windows Server 2016 Datacenter - with Containers VM](https://azure.microsoft.com/en-us/marketplace/partners/microsoft/windowsserver2016datacenterwithcontainers/). 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. Default settings are good
28+
4. Check the Summary and hit "OK". Setup will take a couple of minutes
29+
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).
30+
6. Login with the username and password configured during setup
31+
7. Start PowerShell
32+
8. `Start-Service docker`
33+
9. Check that Docker is running with `docker version`
2334

24-
Once Windows Server 2016 is running, log in, run Windows Update to ensure you have all the latest updates and install the Windows-native Docker Engine directly (that is, not using “Docker for Windows”). You have two options for that:
35+
![Creating Azure Virtual Machine](images/Azure-ws2016-Create-Virtual-Machine.PNG)
2536

26-
#### Option 1
27-
GitHub user @PlagueHQ has set-up a [Powershell script](https://www.powershellgallery.com/packages/Install-DockerOnWS2016UsingDSC/1.0.1/DisplayScript "DockerOnWS2016UsingDSC Script") in the Powershell Gallery. You can run it in two steps:
37+
![Connecting to Azure Virtual Machine](images/Azure-ws2016-Connect.PNG)
2838

29-
```
30-
Install-Script -Name Install-DockerOnWS2016UsingDSC
31-
Install-DockerOnWS2016UsingDSC.ps1
32-
```
39+
## Windows Server 2016 on bare metal or in VM
40+
41+
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.
42+
43+
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.
44+
45+
### PowerShell Package Provider (recommended)
46+
47+
Microsoft maintains a [PowerShell package provider](https://www.powershellgallery.com/packages/DockerMsftProvider) that lets easily install Docker on Windows Server 2016.
3348

34-
#### Option 2
35-
To run it in a more manual fashion, you can install it using NuGet. Run the following in an Administrative PowerShell prompt:
49+
Run the following in an Administrative PowerShell prompt:
3650

3751
```
38-
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
3952
Install-Module -Name DockerMsftProvider -Force
4053
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
4154
Restart-Computer -Force
4255
```
4356

44-
Docker Engine is now running as a Windows service, listening on the default Docker named pipe. 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:
57+
### PowerShell Desired State Configuration
58+
59+
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).
60+
61+
Here's how to use it:
4562

4663
```
47-
# Open firewall port 2375
48-
netsh advfirewall firewall add rule name="docker engine" dir=in action=allow protocol=TCP localport=2375
49-
50-
# Configure Docker daemon to listen on both pipe and TCP (replaces docker --register-service invocation above)
51-
Stop-Service docker
52-
dockerd --unregister-service
53-
dockerd -H npipe:// -H 0.0.0.0:2375 --register-service
54-
Start-Service docker
64+
Install-Script -Name Install-DockerOnWS2016UsingDSC
65+
Install-DockerOnWS2016UsingDSC.ps1
5566
```
5667

68+
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/).
69+
70+
Whether using the PowerShell Package Provider or DSC, Docker Engine is now running as a Windows service, listening on the default Docker named pipe.
71+
72+
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:
73+
74+
# Open firewall port 2375
75+
netsh advfirewall firewall add rule name="docker engine" dir=in action=allow protocol=TCP localport=2375
76+
77+
# Configure Docker daemon to listen on both pipe and TCP (replaces docker --register-service invocation above)
78+
Stop-Service docker
79+
dockerd --unregister-service
80+
dockerd -H npipe:// -H 0.0.0.0:2375 --register-service
81+
Start-Service docker
82+
5783
The Windows Server 2016 Docker engine can now be used from the VM host by setting `DOCKER_HOST`:
5884
`$env:DOCKER_HOST = "<ip-address-of-vm>:2375"`
5985

60-
## Next Steps
86+
# Next Steps
6187
See the [Microsoft documentation for more comprehensive instructions](https://msdn.microsoft.com/virtualization/windowscontainers/containers_welcome "Microsoft documentation").
6288

6389
Continue to Step 2: [Getting Started with Windows Containers](WindowsContainers.md "Getting Started with Windows Containers")
Loading
Loading

0 commit comments

Comments
 (0)