简体   繁体   中英

Connect to Dockerized IIS remotely

I have run an IIS from the official image ( https://hub.docker.com/r/microsoft/iis/ ) on windows Server 2016

Is there any way to connect to that IIS from an IIS Manager so I could have a GUI Access to that IIS?

I don't have a solution for you, but I do have a recommendation:

The core concept behind Docker is that all your application configuration is expressed as code. I recommend creating a Dockerfile (one per service) which uses FROM microsoft/iis and configure the site within, including all site files. This ensures that wherever your created image is launched, it will run exactly as you designed.

Docker is a paradigm shift. I wouldn't recommend expecting things to work exactly as they did before.

There is a solution to it, which contains of following parts. 1. You need to create local username/password in Container Image 2. You need to install IIS configuration tools Detailed instructions are in walkthrough below https://github.com/artisticcheese/artisticcheesecontainer/wiki

Use the following docker file:

FROM mcr.microsoft.com/windows/servercore/iis

SHELL [ "powershell" ]

#setup Remote IIS management
RUN Install-WindowsFeature Web-Mgmt-Service; \
    New-ItemProperty -Path HKLM:\software\microsoft\WebManagement\Server -Name EnableRemoteManagement -Value 1 -Force; \
    Set-Service -Name wmsvc -StartupType automatic;

#Add user for Remote IIS Manager Login
RUN net user iisadmin Password~1234 /ADD; \
    net localgroup administrators iisadmin /add;

Build it using docker build -t iisremote.

Run it using docker run --name remoteiis -d iisremote

Get the IP address of the container using docker inspect --format '{{.NetworkSettings.Networks.nat.IPAddress }}' remoteiis

Connect to the container in IIS using the IP address optioned above

在此处输入图像描述

在此处输入图像描述

and the username and password used in the dockerfile

在此处输入图像描述

If you do not have the option in IIS to connect to a server, then you will need to install IIS Manager for Remote Administration from here . See this serverfault question for more info.

Note

When I tried creating a container directly from the IIS image (without the local dockerfile), connecting to the container using a terminal, and running the same powershell commands (that are in the dockerfile above) directly in the container terminal it does not work.

Source

https://devblogs.microsoft.com/premier-developer/iis-remote-management-for-docker-containers/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM