Over a million developers have joined DZone.

Docker on Windows Server 2016 (Part 2)

Follow along to learn how how to configure Docker on a Windows 2016 virtual machine.

· Cloud Zone

Build fast, scale big with MongoDB Atlas, a hosted service for the leading NoSQL database on AWS. Try it now! Brought to you in partnership with MongoDB.

This blog is part of a multi-part series. The first part showed how to set up Windows Server 2016 as a VirtualBox VM. This second part will show how to configure Docker on Windows 2016 VM.

Start an elevated PowerShell session:docker-windows-2016-22 Run the script to install Docker:

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider
Restart-Computer -Force


This will install the PowerShell module, enable containers feature and install Docker.

docker-windows-2016-23The VM needs to be restarted in order for the containers to be enabled. Refer to Container Host Deployment – Windows Server for more detailed instructions.

The VM reboots. Start a PowerShell and check the Docker version using docker version:

docker-windows-2016-24More details about Docker can be found using the docker info command:

docker-windows-2016-25

Run your first Docker container using the docker run -it -p 80:80 microsoft/iis  command:

docker-windows-2016-26This will download the Microsoft IIS server Docker image. This is going to take a while so please be patient!Once the 8.9 GB image is downloaded (after a while), the IIS server is started for you. Check the list of images using the docker images command and the list of running containers using the docker ps command:

docker-windows-2016-27More details about the container can be found using the docker inspect command:

The exact IP address of the container can be found using the command:

docker inspect --format '{{ NetworkSettings.Networks.nat.IPAddress }}' cocky_mahavira


The IIS main page is accessible at http://<container-ip>, as shown below:docker-windows-2016-28

The next part will show how to create your own Docker image on Windows Server 2016.

Now it's easier than ever to get started with MongoDB, the database that allows startups and enterprises alike to rapidly build planet-scale apps. Introducing MongoDB Atlas, the official hosted service for the database on AWS. Try it now! Brought to you in partnership with MongoDB.

Topics:
docker ,cloud ,windows server 2016 ,vm

Published at DZone with permission of Arun Gupta, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}