Deploying Docker Containers to Windows Server 2016

Posted: December 15, 2016 in Windows Server

First we need to install the OneGet PowerShell module and Docker itself:

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

1

If You get error regarding missing KB3176936,installing that package won’t solve the problem.

2

Instead,we need to fully update Windows Server:

sconfig.cmd

 

5

 

Press 6,then press A

4

Press A again

 

5

Now you should be able to install docker (run again)

Install-Package -Name docker -ProviderName DockerMsftProvider

See available Web server images:

docker search iis --no-trunc

 

 

6.png

I choose to install nanoserver/iis (about 300 MB against microsoft/iis 4 GB)

docker run -it -p 80:80 nanoserver/iis cmd

-i interactive Keep STDIN open even if not attached

-t  Allocate a pseudo-TTY

-p 80:80 map docker host port 80 (Windows Server) to container post 80,consider it as port mapping

cmd run Command prompt upon container start

I changed default IIS welcome page:

del C:\inetpub\wwwroot\iisstart.htm
echo "If you see this page,it means you have reached IIS test page running on IIS nano-server container.It's awesome :-)" > C:\inetpub\wwwroot\index.html

Try to access IIS container’s web page,192.168.0.5 is IP address of Windows Server (container host)

 

7.PNG

We can save this modified container for future use,first find out name of this container:

docker ps -a

 

8

Now save this image:

docker commit sharp_lalande modified-iis
docker images

 

 

9

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s