(: March 9, 2019)

In this tutorial, we will look at how you can configure your Windows server 2019 to run Docker containers. Docker has been a game changer in Applications containerization and the whole microservices design and deployment patterns. Docker makes it easy to build, ship and run images containing applications with their dependencies and avoid crazy dependency issues common with the use of Virtual Machines.

Docker engine is what powers docker containers. It was originally written for Linux but a lot of work has been done to enable Windows and macOS users to run Docker containers.

One pre-requisite is the installation of a Windows server. This can be on a Virtual Machine running on-premise, a Physical server deployment or a Cloud instance running in Azure. You can refer to our installation guide below.

.td_uid_2_5d90885568afb_rand.td-a-rec-img{text-align:left}.td_uid_2_5d90885568afb_rand.td-a-rec-img img{margin:0 auto 0 0}

How to Install Windows Server 2019 Step by Step

How to run Docker Containers on Windows Server 2019

Before you can use the Windows Containers to run multiple isolated applications your system, you’ll need to enable the containers feature and install Docker on Windows Server 2019.

Step 1: Enable the containers feature in Windows Server 2019

The first step is to enable the Windows Server 2019 containers feature. Open PowerShell as Administrator.

Run the following commands.

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

This will install the Docker-Microsoft PackageManagement Provider from the PowerShell Gallery. 

Sample output is as shown below:

Step 2: Install Docker on Windows Server 2019

once the Containers feature is enabled on Windows Server 2019, install the latest Docker Engine and Client by running the command below in your PowerShell session.

Install-Package -Name docker -ProviderName DockerMsftProvider

Agree to the installation using “Yes” or “Y” or “A” to Agree to all.

When the installation is complete, reboot the computer.

Restart-Computer -Force

Installed Docker version can be checked with:

Administrator> Get-Package -Name Docker -ProviderName DockerMsftProvider
Name Version Source ProviderName
---- ------- ------ ------------
docker 18.09.2 DockerDefault DockerMsftProvider

The same can be achieved with the docker --version command.

PS C:UsersAdministrator> docker version
Version: 18.09.2
API version: 1.39
Go version: go1.10.6
Git commit: 1ac774dfdd
Built: unknown-buildtime
OS/Arch: windows/amd64
Experimental: false
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

Upgrade can be done anytime by running the following commands on PowerShell.

Install-Package -Name Docker -ProviderName DockerMsftProvider -Update -Force
Start-Service Docker

Step 3: Run Docker Container

Start Docker Daemon

Start-Service Docker

After starting Docker Engine service, Download the pre-created .NET sample image from the Docker Hub registry:

docker pull microsoft/dotnet-samples:dotnetapp-nanoserver-1809

Then deploy a simple container running a .Net Hello World application.

docker run microsoft/dotnet-samples:dotnetapp-nanoserver-1809

The container will start, print the hello world message, and then exits.

Running Linux Containers on Windows Server 2019

Out of the box, Docker on Windows only run Windows container. To use Linux containers on Windows Server, you need to use the Docker Enterprise Edition Preview which includes a full LinuxKit system for running Docker Linux containers.

Uninstall your current Docker CE.

Uninstall-Package -Name docker -ProviderName DockerMSFTProvider

Enable Nested Virtualization if you’re running Docker Containers using Linux Virtual Machine running on Hyper-V.

Get-VM WinContainerHost | Set-VMProcessor -ExposeVirtualizationExtensions $true

Then install the current preview build of Docker EE.

Install-Module DockerProvider
Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview

Enable LinuxKit system for running Linux containers

[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")

Restart Docker Service after the change.

Restart-Service docker

Pull a test docker image.

> docker run -it --rm ubuntu /bin/bash
[email protected]:/# cat /etc/os-release
VERSION="18.04.1 LTS (Bionic Beaver)"
PRETTY_NAME="Ubuntu 18.04.1 LTS"

[email protected]:/# exit

To Switch back to running Windows containers, run:

[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "$null", "Machine")

Enjoy running Linux and Windows containers on Windows Server 2019. Drop us a comment in case of any issues.

Also check:

How to install Applications from Windows command line

How to Allow ICMP Echo Reply on Windows Server 2019

How to enable Remote Desktop Protocol (RDP) on Windows Server 2019

How to run Linux on Windows Server 2019 with WSL

.td_uid_4_5d90885568d0c_rand.td-a-rec-img{text-align:left}.td_uid_4_5d90885568d0c_rand.td-a-rec-img img{margin:0 auto 0 0}
  • A Court Date for QuadrigaCX: What to Expect at Today’s Hearing
  • Twitter Will Ban ICO Ads Starting Tomorrow
  • Quantum Computers Could Jack Your Crypto Private Key in 10 Years, Researchers Say
  • Ripple CEO Defends XRP’s Utility at Fintech Conference
  • CPA Trade Association Pushes IRS for Bitcoin Tax Guidance
  • Tensions Emerge Between Hyperledger Blockchain Group’s Biggest Supporters
  • Blockchain of the Vanities? Sibos, Swell and Stellar Troll in Toronto
  • Robocoin Offers Bitcoin ATM Operators 0% Fees for Life
  • C-Suite Departure: Coinbase’s Chief Product Officer Has Left the Startup
  • Using Bulk Optimization in Managed WordPress Portal
  • Stolen Bitcoin? Anti-Theft Feature Gets Second Life on Sidechains
  • JavaScript Charts Tutorial
  • Blockchain Association Takes Over Kik’s ‘Defend Crypto’ Crowdfunding Effort
  • Creating Storm Server Images
  • How to install bash shell in Alpine Linux
  • SXI LLC Company
    SXI.IO is a global Blockchain software company, specialized in developing white label crypto exchange platforms , Wallet platforms, ICO platforms, Token Erc20 .....
    Fully Managed VPS Fully Managed VPS Fully Managed VPS

    You Might Also Enjoy NewS Post

    Best Free Web Hosting 2020

    Free Hosting 1GB $0.00 USD/mo Disk space 1GB Traffic 10GB/Month Domains 2 Plesk Cpanel Databases 10 Free 12 Month https://my.sxi.io/cart.php?a=add&pid=196

    02/05/2020 READ MORE