未加星标

Install Docker on Windows Server 2016 using DSC

字体大小 | |
[系统(windows) 所属分类 系统(windows) | 发布者 店小二03 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

windows Server 2016 is now GA and it contains some pretty exciting stuff. Chief among them for me is support for containers by way of Docker . So, one of the first things I did was start installing Windows Server 2016 VM’s (Server Core and Nano Server naturally) and installing Docker on them so I could begin experimenting with Docker Swarms and other cool stuff.

At first I started using the standard manual instructions provided by Docker, but this doesn’t really suit any kind of automation or infrastructure as code methodology. This of course was a good job for PowerShell Desired State Configuration (DSC) .

So, what I did was put together a basic DSC config that I could load into a DSC Pull Server and build out lots of Docker nodes quickly and easily. This worked really nicely for me to build out lots of Windows Server 2016 Container hosts in very short order:


Install Docker on Windows Server 2016 using DSC

If you don’t have a DSC Pull server or you just want a simple script that you can use to quickly configure a Windows Server 2016 (Core or Core with GUI only) then read on.

Note: This script and process is really just an example of how you can configure Docker Container hosts with DSC. In a real production environment you would probably want to use a DSC Pull Server.

Get it Done

On a Windows Server 2016 Server Core or Windows Server 2016 Server Core with GUI server:

Log on as a user with Local Administrator privileges. Start an Administrator PowerShell console if you’re using Server Core just enter PowerShell at the command prompt:
Install Docker on Windows Server 2016 using DSC
Install the DSC Resources required for the DSC configuration by executing these commands:
You may be asked to confirm installation of these modules, answer yes to any confirmations.
Install Docker on Windows Server 2016 using DSC
Download the Docker installation DSC script by executing this command:
Install Docker on Windows Server 2016 using DSC
Run the Docker installation DSC script by executing this command:
Install Docker on Windows Server 2016 using DSC

The script will run and reboot the server once. Not long after the reboot the Docker service will start up and you can get working with containers:


Install Docker on Windows Server 2016 using DSC

You’re now ready to start working with Containers.

What the Script Does

In case you’re interested in what the script actually contains, here are the components:

Configuration ContainerHostDsc the DSC configuration that configures the node as a Docker Container host. Configuration ConfigureLCM the LCM meta configuration that sets Push Mode , allows the LCM to reboot the node if required and configures ApplyAndAutoCorrect mode. ConfigData a ConfigData object that contains the list of node names to apply this DSC Configuration to in this case LocalHost. ConfigureLCM the call to the Configuration ConfigureLCM to compile the LCM meta configuration MOF file . Set-DscLocalConfigurationManager this applies the compiled LCM meta configuration MOF file to LocalHost to configure the LCM. ContainerHostDsc the call to the Configuration ContainerHostDsc to compile the DSC MOF file. Start-DSCConfiguration this command starts the LCM applying the DSC MOF file produces by the ContainerHostDsc .

The complete script can be found here . Feel free to use this code in anyway that makes sense to you.

Happy containering!

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

分页:12
转载请注明
本文标题:Install Docker on Windows Server 2016 using DSC
本站链接:http://www.codesec.net/view/483376.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(73)