Connect to a Windows Container Using IIS Management Console

In this blog post about Windows Server Containers, I will show you how I connect to Microsoft IIS Server running inside Windows Server Core Container from a management machine with IIS 10 console.

One of the most popular usages of Windows Containers is using it as a Web Server for front end applications and sometimes you might need to get visibility to IIS from the IIS console and not from PowerShell.

My Environment

In my current environment, I have Windows Server Core with IIS running as a Container.

My Container host is running Windows Server 2016

To get this done, I will create a Container with port 80 and 1872 open, port 80 is for IIS and port 1872 is the IIS Server management port.

Create Container

To create my Windows IIS web server container I will run the docker command below.

docker run -it --name webapp -p 80:80 -p 1872 microsoft/iis:latest

Run commands

After the container has been created, I will run the PowerShell cmdlets below inside the container.

The cmdlet below will install IIS

Add-WindowsFeature web-mgmt-service

The 2nd cmdlet will enable IIS

Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WebManagement\Server -Name EnableRemoteManagement -Value 1

The 3rd cmdlet will create a local user and set his password

net user simon "PASSWORD" /add

The 4th cmdlet will add the local user to the Administrators group (This step is very important)

Add-LocalGroupMember -Group administrators -Member simon

And finally, restart the service below

restart-Service wmsvc

And finally, I will grab the IP address of my container by typing ipconfig

Connect

On my management machine, I will open my the IIS console -> right-click -> Connect to a Server

In the Server name, I will type the Container IP address

And type the username and password on the Newley created user

And done, I can see all the sites that are running on my IIS container and I can also make changes


Posted

in

by

Comments

2 responses to “Connect to a Windows Container Using IIS Management Console”

  1. Peri Avatar
    Peri

    Hi I followed the instructions above, but when i try to connect to the remote server, i get “Unable to connect to the remote server”.

  2. rocksdad Avatar
    rocksdad

    nice article! any chance this works on host of Win10?