This TechNet Wiki article provides an overview on how to pull a Windows Server Insider Preview container image using Docker and run a Windows Server Insider Preview container using Windows Containers feature on Windows 10. This page focuses on Windows Server Insider Preview deployment preparation in Windows Containers environment with Docker.

1. Introduction

With the latest Insider Preview release of Windows Server, Windows Server Insider Preview is the currently the latest Windows Server operating system in Server Core that has been containerization for developers and this walk-through will get you started testing on Windows Server Insider Preview container in your Windows 10 quickly.

 

↑ Return to Top


 

2. Requirements

In order to work on NanoServer container, you will need to meeting the following requirements below.

 

↑ Return to Top


 

3. Preparation on Windows 10

Let us begin in preparing your Windows 10 to run Windows Server Insider Preview container.

 

↑ Return to Top


 

3.1. Install Hyper-V and Containers Windows 10 Features

Firstly, we will need to enable the following Windows 10 Features to start off.


# Enable Hyper-V and Containers Windows 10 Features
Enable-WindowsOptionalFeature `
    -FeatureName Microsoft-Hyper-V, Containers `
    -Online `
    -All ;

 

↑ Return to Top


 

3.2. Validate Hyper-V and Containers Windows 10 Features are Enabled

Next, validate that Microsoft-Hyper-V and Containers are enabled.


# Validate Microsoft-Hyper-V and Containers Windows 10 Features
# is Enabled
"Microsoft-Hyper-V","Containers" | `
    ForEach-Object { `
        Get-WindowsOptionalFeature `
            -Online `
            -FeatureName $_ ;
    } ;

 

↑ Return to Top


 

3.3. Download Docker using PowerShell

Once we have validated Windows 10 requirements are met, let us download the Docker for Windows package using PowerShell


# Download Docker package
Invoke-WebRequest `
    -Uri 'https://download.docker.com/win/stable/InstallDocker.msi  ' `
    -OutFile 'C:\Temp\InstallDocker.msi' ;

↑ Return to Top


 

3.4. Install Docker using PowerShell

Once the download has completed, let us install the Docker for Windows using PowerShell.


# Install Docker
Start-Process `
    -FilePath 'C:\Windows\System32\msiexec.exe' `
    -ArgumentList '/I C:\Temp\InstallDocker.msi /quiet' `
    -Wait ;

 

Once the installation has completed, restart your Windows 10.

 

↑ Return to Top


 

3.5. Switch Docker Linux Containers to Windows Containers engine using PowerShell

After a reboot and you have logged into Windows, switch the Docker's default Linux Containers to Windows Containers engine using PowerShell.


# Switch Docker to Windows Containers
Start-Process `
    -FilePath 'C:\Program Files\Docker\Docker\DockerCli.exe' `
    -ArgumentList '-SwitchDaemon' `
    -Wait ;

↑ Return to Top


 

3.6. Validate Docker is on Windows Containers engine using DockerCLI

Use the DockerCLI with Info parameter to generate a general information of the system and confirm that it is on Windows 10 operating system instead of Linux.


# Display Docker Information using
# Docker Info command
docker info

 

 

↑ Return to Top


 

3.7. Install PowerShell for Docker (Optional)

If you are interested in managing Docker containers with PowerShell, you can continue to follow this to obtain PowerShell for Docker module. This is totally optional.

Note: The PowerShell for Docker module is still in development phase at the time of this article is published.

 

↑ Return to Top


 

3.7.1. Install NuGet Package Manager

Firstly, you will have to install the NuGet Package Manager.


# Install NuGet Package Manager
Install-PackageProvider `
    -Name NuGet `
    -MinimumVersion 2.8.5.201 `
    -Force ;

↑ Return to Top


 

3.7.2. Register the PowerShell for Docker Repository

Secondly, you will need register the PowerShell for Docker repository.


# Register the PowerShell for Docker Repository
Register-PSRepository `
    -Name DockerPS-Dev `
    -SourceLocation https://ci.appveyor.com/nuget/docker-powershell-dev ;
Once you have registered the repository, you can validate the PowerShell for Docker Repository is registered as below.

# Validate the PowerShell for Docker Repository
#  is registered
Get-PSRepository `
    -Name DockerPS-Dev ;

↑ Return to Top


 

3.7.3. Install the PowerShell for Docker module

Finally, you will install the PowerShell for Docker module.


# Install the PowerShell for Docker development module
#  for current user
Install-Module `
    -Name Docker `
    -Repository DockerPS-Dev `
    -Scope CurrentUser ;
You can validate if the PowerShell for Docker module has been installed as below.

# Validate the PowerShell for Docker development module
#  is installed
Get-InstalledModule `
    -Name Docker ;

 

↑ Return to Top


 

3.7.4. Import the Docker PowerShell Module

Once you have installed the PowerShell for Docker module, you will need to load the PowerShell for Docker module into your current PowerShell console.


# Import the installed PowerShell for Docker module
Import-Module `
    -Name Docker ;

To validate that PowerShell for Docker module is loaded on your current PowerShell console, you can use the command below.


# Validate the PowerShell for Docker development module
#  is loaded
Get-Module `
    -Name Docker ;

 

↑ Return to Top


 

4. Getting Started with Windows Server Insider Preview Container

With the system prepared, let get some fun in containerisation by get an image online and create your very first container.

 

↑ Return to Top


 

4.1. Pull a Windows Server Insider Preview Container image

Perform a Pull Request for latest Windows Server Insider Preview Container image using Docker.

You can do this using DockerCLI pull command as below.


# Pull the microsoft/windowsservercore-insider Docker
# image using DockerCLI
docker pull microsoft/windowsservercore-insider

Or use the Pull-ContainerImage command from PowerShell for Docker module as below.


# Pull the microsoft/windowsservercore-insider Docker
# image using PowerShell
Pull-ContainerImage `
    -Repository "microsoft/windowsservercore-insider" ;

 

 

↑ Return to Top


 

4.2. List all available images

Validate NanoServer image available after the DockerCLI Pull Request.

You can do this using DockerCLI pull command as below.


# List all available images using DockerCLI
docker images

Or use the Get-ContainerImage command from PowerShell for Docker module as below.


# List all available images using PowerShell
Get-ContainerImage ;

 

 

↑ Return to Top


 

4.3. Create a new Windows Server Insider Preview container from the image

Now, let us create a Windows Server Insider Preview container.

You can do this using DockerCLI pull command as below.


# Create a new container name WindowsServerInsider
# using Docker Create command
docker create -t --name WindowsServerInsider -h WindowsServerIn -i microsoft/windowsservercore-insider

Or use the New-Container command from PowerShell for Docker module as below.


# Create a new container name WindowsServerInsider
# using PowerShell
New-Container `
    -Name WindowsServerInsider `
    -ImageIdOrName microsoft/windowsservercore-insider `
    -Terminal ;

 

↑ Return to Top


 

4.4. List all available containers

Validate the new NanoServer container is created.

You can do this using DockerCLI pull command as below.


# List all available containers using DockerCLI
docker container ls -a

Or use the Get-Container command from PowerShell for Docker module as below.


# List all available containers using PowerShell
Get-Container ;

 

 

↑ Return to Top


 

4.5. Start the container

Now that we have prepare the container, we can start the container and enter into the NanoServer container session interactively.

You can do this using DockerCLI pull command as below.


# Start the Windows Server Insider Preview container
# interactively using DockerCLI
docker start -i WindowsServerInsider

Or use the Start-Container command from PowerShell for Docker module as below.

# Start the Windows Server Insider Preview container
# interactively using PowerShell
Start-Container `
    -ContainerIdOrName WindowsServerInsider `
    -Attach ;

 

 

↑ Return to Top


 

5. Conclusion

There you have it. Windows Server Insider Preview in a nutshell for testing and development.

 

 

↑ Return to Top


 

6. Reference

 

↑ Return to Top


 

7. See Also

 

↑ Return to Top