Get started with Docker and Windows Server containers

Overview

With the release of the Windows Server 2016 Technical Preview 3 (TP3) release, Microsoft first provided native containers on the Windows platform. It integrates Docker's support for Windows Server, which means that you can run the Docker container in a Windows environment.
1.webp_.jpg
The first thing to understand is that this is not the first time to provide a container under Windows. Odin (a software hosting company) has been through its own system to provide Windows containers for more than a decade. Considering that they did not get any source code provided by Microsoft, this is not a simple matter.

Second, Windows containers (even Docker) are only used to run Windows applications. Even with common features, all existing Linux-based containers can not run in Windows, and for those start-up I think this is a normal transition point.

There are also two Windows container technology is also true, one based on Hyper-V, the other can be directly run in Window Server 2016 (referring to the Windows Server container). The latter has been provided in this release, so we will test it here.

Start using Windows 2016

000.webp_.jpg

The entire installation process is very simple, select the type of installation, select a driver until the installation is complete. In my experience, I think this is what I have come across with the installation of the simplest Windows, all set and run for less than 5 minutes. Of course, this is a good start.

000.webp_(1)_.jpg

This is the first time I use Windows 2016, and if you are familiar with Windows 10 and Windows Server 2012, you will feel (at least visually) it is a mixture of two. In fact, since the 2012 R2 version has been a lot of problems have been fixed. For Server, the sticker navigation is (now still) a very bad idea, especially at the time of remote management. As shown in the screenshot above, Microsoft has returned to a more familiar and intuitive normal boot menu drive system.

Install the container

Once your Windows 2016 TP3 base version is installed, you can install the Windows Server container component Docker and create the required container mirroring. Microsoft has a guide to help you complete the whole simple process. Although there are only three steps, it takes some time because the last step requires downloading the underlying mirror of the container (greater than 3GB).

note:

Be sure to install the mirror according to the following guidelines. If this is not the case, the container will not work as expected.

Let's take a look at what PowerShell scripts do specifically. While it is nice to install a single line from a time-saving perspective, you need to thoroughly check every step to see what it does. Especially when it is the production server, you should never blindly install any scripts that you have not checked or do not understand.

The first step is to create a virtual switch for the networking of the container. It allocates 127.16.0.1/12 IP addresses and NAT by using DHCP to make the external accessible host. Next, install the container component (Install-Feature -FeatureName Containers) and then install a "zdp.cab" if it is available. This is quite vague and this file does not exist in my system. Google search did not find the relevant results, the closest is the " Zero Day Package ", that it simply updates the summary file.

Then the installer downloads "ContainerBaseImage.wim" and puts it in the C drive. This will take some time, because the base image is still more than 3GB. An interesting note in the PowerShell script is that Microsoft has disabled the progress bar for performance. It made me curious, I tested the download (using wget) and enabled the progress bar, which cost the two cores 70% of the performance, so they are not kidding. Once the .wim file is downloaded, install the basic container image (using the "Install-ContainerOsImage" command).

The next Docker has already been downloaded and has been installed. And then NSSM is "Non-Sucking Service Manager" with the help of start the service. Finally, the base image has been marked in the Docker, and then you can use it.

Windows Server container: new start

In Conteix, we have used Windows Odin container for more than 10 years, so the container concept is not new. But there are still a few key differences, of course, this is also with the development of the product in the ever-changing. The most important is that the base image (.wim file) must exactly match the current host version and patch level. If you want your server to patch, you need to re-download and install the container image. I hope this is just a simple question and Microsoft can have a way to automatically update the patch level when publishing the official version.

Then, not everything is smooth sailing. In the preview version may appear to re-execute some instructions or even delete the re-create the container. All commands are executed through PowerShell, and you need to ensure that PowerShell runs under administrator privileges.

Let's start by creating a base container:
New-Container -Name "WinContainerTest" -ContainerImageName WindowsServerCore -SwitchName "Virtual Switch"
This does not start the container, so now we have to execute the Start-Container command:
Start-Container WinContainerTest

--.webp_.jpg

PowerShell will initially display a progress bar. In my system, very fast only took 5 minutes to start. Probably I now lack the experience of using PowerShell, through the container to do some operations slightly difficult. Although you can create and start it by name, access it through PowerShell before you need to get its ID. Get-Container will still return some output (as shown below), or an object.

(In my opinion) no way to get the ID directly through the command. So, we need to save the data through the PowerShell object and then enter the ID of the object into PowerShell. The order is as follows:
$container = Get-Container "WinContainerTest"
Enter-PSSession -ContainerId $container.ContainerId -RunAsAdministrator

We've got into the container. In order to highlight it, I have to implement the ipconfig command:
“ “
[C2d9f681-aa4]: PS C: \ Windows \ system32> ipconfig

Windows IP Configuration

Ethernet adapter vEthernet (Virtual Switch-C2D9F681-AA47-4652-B8EC-EED812EF8B25-0):
Connection-specific DNS Suffix.
Link-local IPv6 Address. ….: Fe80 :: 3de8: 8a78: 5788: 8191
IPv4 Address……….: 172.16.0.2
Subnet Mask……….: 255.240.0.0
Default Gateway. ………: 172.16.0.1
[C2d9f681-aa4]: PS C: \ Windows \ system32>
“ “
By simply testing, the final display of WIndows 2016 TP3 has a basic usable container system.

Docker … and Windows

Is it a Docker novice? Make sure you have read my article " What is Docker " and it will help you speed up. In nutshell, Docker is an application-level container and in the Linux world it has grown dramatically over the past 18 months. Once you start using Docker, you will understand why this is so. Application deployment becomes easy to manage and can be very tightly controlled. This will also make the Windows platform application great benefit.
https://msdn.microsoft.com/virtualization/windowscontainers/quick_start/manage_docker
Let's take a look at what mirror we have:
C:\Users\Administrator> docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
windowsservercore 10.0.10514.0 0d53944cb84d 3 weeks ago 9.697 GB
windowsservercore latest 0d53944cb84d 3 weeks ago 9.697 GB
PS C:\Users\Administrator>

You can see a basic windowsservercore image, so let's start the Docker container and interact quickly with it (using the -it flag):
docker run -it --name dockerdemo windowsservercore powershell.exe
We use the underlying core image and execute PowerShell. Although it does not seem to do a lot of things, if you execute the ipconfig command you can see the container's network details. The following is my screen output:
“ “
PS c: \ windows \ system32> ipconfig

Windows IP Configuration

Ethernet adapter vEthernet (Virtual Switch-b68c41a9a1a36852173aca061b3e7d70d06c288724c9d04701110b9aa8033d22-0):

Connection-specific DNS Suffix.
Link-local IPv6 Address. ….: Fe80 :: 8817: 363c: 10d9: b94e
IPv4 Address……….: 172.16.0.2
Subnet Mask……….: 255.240.0.0
Default Gateway. ………: 172.16.0.1
PS C: \ Windows \ system32>
在测试的时候我遇到了几个错误,比如不能通过名字和ID引用Docker容器。对于第一个版本,也将会出现像这样的状况,但并没有什么大的问题。为了解决问题,我简单地重启了Docker服务:
Net stop docker
Net start docker
“ “
This operation can solve all the minor problems every time, so if you want to do a lot of Docker related development in the early Windows platform please remember this convenient way.

Let's take a look at the mirror here:
docker search microsoft
PS C:\Users\Administrator> docker search microsoft
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
microsoft/iis Internet Information Services (IIS) instal... 1 [OK] [OK]
microsoft/dnx-clr .NET Execution Environment (DNX) installed... 1 [OK] [OK]
microsoft/ruby Ruby installed in a Windows Server Contain... 1 [OK]
microsoft/rubyonrails Ruby on Rails installed in a Windows Serve... 1 [OK]
microsoft/python Python installed in a Windows Server Conta... 1 [OK]
microsoft/go Go Programming Language installed in a Win... 1 [OK]
microsoft/mongodb MongoDB installed in a Windows Server Cont... 1 [OK]
microsoft/redis Redis installed in a Windows Server Contai... 1 [OK]
microsoft/sqlite SQLite installed in a Windows Server Conta... 1 [OK]
PS C:\Users\Administrator>

Great! As a Python programmer, I am keen on fast:
docker pull microsoft/python
Now the mirror is downloaded and we will run a quick and interactive Python shell that will be destroyed when it is launched:
docker run -it --rm microsoft/python cmd
Very unfortunate, did not run as expected. I even had to point out "cmd" to make the container run, and so far did not find the right way for python to run. Obviously this is where they are working hard.

to sum up

For Microsoft this is an early area, so I can not be too harsh on the product. There is still a long way to go before the container becomes a production environment system. At the same time, there have been many promises so far. I did not expect the container to appear in the preview this year so I was a little surprised. It must be reiterated that this is a technical preview . There will be a lot of bugs and flaws, so far it is not a complete system. Fortunately, Microsoft has a " Work In Progress " page that lists all current warnings and known issues.

08.webp_.jpg

If they do this, the container provides a great middle ground between installing everything into a server and fully virtualizing. Hypervised and a mixture of containerized environments will be possible, and it is likely to be heavily used in the Linux field. I firmly believe that through Docker to provide clean and reused application deployment will produce many developers.

Reducing the amount of space occupied by a large number of servers requires a strong focus on Microsoft's actions, at least what they show to show that they also need to work hard. Some Linux-based operating systems (such as COS ) are very lightweight only 454MB to run the Docker container. However, the basic installation of Windows 2016 requires 11GB, and if you want to install Docker and container function is more than 20GB. The base container image is compressed by more than 3GB, so there is still much work to do in this area.

Overall, we look forward to the next update, we will continue to pay close attention to Windows Server container technology development and mature progress.

78.webp_.jpg
Tim Butler

With more than 20 years of experience in the IT industry, I have been involved in developing high concurrent systems. I am currently working on large high-performance web, email and VM platforms for large companies and Australian government departments.

Docker technology how to bring value to business

Xiyun is an expert in the field of Docker and is committed to providing better cloud computing products and services through Docker technology. Xiyun brand products included

  • COS container operating system
  • CSphere container management platform
  • CDT container-based development test platform
  • CShow container-based project demonstration platform –
  • CHub Enterprise Registry

And provide relevant training and advisory services

  • Micro mirror service
  • Docker Corporate Training
  • Application of Docker Consulting
  • Software SaaS Consulting
  • PaaS consultation

Welcome business inquiries:

  • Tel: 400-686-1560
  • E-mail: contactus@csphere.cn

Focus on cSphere-CN

Reply to the number "1" to see [Docker continued deployment graphic Detailed]

789437542565210719.jpg

Reproduced statement

Respect for knowledge, please reprint, must not be deleted, including the Bank.

    Heads up! This alert needs your attention, but it's not super important.