简体   繁体   English

远程连接到 Dockerized IIS

[英]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我在 windows Server 2016 上运行了来自官方映像 ( https://hub.docker.com/r/microsoft/iis/ ) 的 IIS

Is there any way to connect to that IIS from an IIS Manager so I could have a GUI Access to that IIS?有没有什么方法可以从 IIS 管理器连接到 IIS,这样我就可以通过 GUI 访问 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. Docker背后的核心概念是所有应用程序配置都表示为代码。 I recommend creating a Dockerfile (one per service) which uses FROM microsoft/iis and configure the site within, including all site files. 我建议创建一个Dockerfile(每个服务一个),它使用FROM microsoft/iis并在其中配置站点,包括所有站点文件。 This ensures that wherever your created image is launched, it will run exactly as you designed. 这可确保无论您创建的图像在何处启动,它都将按照您的设计运行。

Docker is a paradigm shift. Docker是一种范式转变。 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 1.您需要在Container Image 2中创建本地用户名/密码。您需要安装IIS配置工具详细说明在https://github.com/artisticcheese/artisticcheesecontainer/wiki下面的演练中

Use the following docker file:使用以下 docker 文件:

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.使用docker build -t iisremote.

Run it using docker run --name remoteiis -d iisremote使用docker run --name remoteiis -d iisremote运行它

Get the IP address of the container using docker inspect --format '{{.NetworkSettings.Networks.nat.IPAddress }}' remoteiis使用docker inspect --format '{{.NetworkSettings.Networks.nat.IPAddress }}' remoteiis获取容器的 IP 地址

Connect to the container in IIS using the IP address optioned above使用上面选择的IP地址连接到IIS中的容器

在此处输入图像描述

在此处输入图像描述

and the username and password used in the dockerfile以及 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 .如果您在 IIS 中没有连接到服务器的选项,则需要从 此处安装 IIS 远程管理管理器。 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.当我尝试直接从 IIS 图像(没有本地 dockerfile)创建容器时,使用终端连接到容器,并直接在容器终端中运行相同的 powershell 命令(在上面的 dockerfile 中)它不起作用。

Source来源

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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