Windows Containers Dockers: A complete Guide
windows Containers dockers can help your business make the most of Windows Server 2016, if you know how to get started.
I have talked about the Windows Containers and VPS Hosting earlier, the details of which you can read in these articles:
- How to Install a Docker Container in Windows Server 2016
- How to Backup a Windows Server Domain Controller
Containers are not made for Tupperware parties any longer, they are a part of the IT world. Even though containers are not yet completely mainstream, companies such as Docker have removed the traditional management burden which came with this technology. A small footprint, lightning fast speed, and portability will make them increasingly popular. What exactly is a container anyhow?
- Containers are operating system sandboxes that are hosted on full operating systems.
- In the situation of Windows containers, those are all hosted on a Windows Server.
- Every container has the minimal amount of resources and any operating system-specific resources will be gathered from the operating system ‘beneath’ them.
Windows containers have their own networking, file system, and registry. Once it requires the option to interact with those systems, it will use the hosting operating system.
Windows Containers Types
There are two types of Windows containers; Windows Server and Hyper-V. A
A Docker Container
Windows Server container is the one that is usually associated with the traditional term ‘container’; for example, a Docker container. Windows Server containers act similarly to how containers in the Linux world act.
However, Hyper-V containers are essentially Windows server containers that run in a Hyper-V partition. These containers exist in a lightweight Hyper-V virtual machine.
Windows Containers Dockers
This tutorial will be focusing on Windows Server containers. There are a couple of ways to get started with Windows Server containers.
You can feel free to select a cloud service such as an Azure Container service which will stop you from having to either bring up physical hardware or provision a new virtual machine to host a container on.
- You can also do this by simply using PowerShell, any machine which runs Windows Server 2016 can be configured to host containers.
- Remember, to create a Windows Server container host, the operating system has to be Windows Server 2016.
If you want to learn more about the underlying container technology, you can use PowerShell to bring up your first Windows Server container. Windows Server containers are made on Docker and thus the first step is installing Docker.
Install Microsoft Docker Provider
To install Docker, you will first have to install the Microsoft Docker provider. This is done using a PowerShell module. Initiate the PowerShell console on your Windows Server 2016 server and install it from the PowerShell gallery.
Find-Module DockerMsftProvider | Install-Module
After the module was installed, install the latest version of Docker using Install-Package. As the module downloaded before is actually a PowerShellGet provider, you may specify this as the provider name to ‘install-Package’. This will allow Install-Package to find the Docker package.
Install-Package -Name docker -ProviderName DockerMsftProvider
Reboot the server. After this, you will be able to run the ‘docker’ command. Below, in this tutorial, we are simply checking the version of Docker to make sure the Windows service it created is running.
If no errors appear, Docker is running. After, you will have to install a Docker base image. This is needed to run Windows server containers. To do this, you will need to use the ‘docker’ command again to pull down either the Windows Server Core or a Nano Server Image from Docker Cloud. Below you will how to download the Windows Server Core image.
docker pull microsoft/windowsservercore
Optionally, the ‘install-Container Image PowerShell’ command can also be run to provision this base image. After it is installed, restart the Docker Windows service.
Restart-Service -Name Docker -Force
After you have installed base image, you will then have a fully-functioning container host. You can then deploy containers at will using ‘docker run’. To do so requires you to specify the name of the container and the image it will be made from.
docker run -it --name mycontainer windowsservercore
You can view the The container with the docker command again using the images argument.
Finally, the ‘mycontainer’ image, as well as the ‘windowsservercore’ image, will be displayed. This should leave you with a fully-configured Windows Server container host running your very first Windows server container.
Do let us know if you want to add any specific Windows or Linux topics into this tutorial series.