{"id":35244,"date":"2019-02-26T08:56:16","date_gmt":"2019-02-26T15:56:16","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/premier-developer\/?p=35244"},"modified":"2019-02-21T09:06:33","modified_gmt":"2019-02-21T16:06:33","slug":"iis-remote-management-for-docker-containers","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/iis-remote-management-for-docker-containers\/","title":{"rendered":"IIS Remote Management for Docker Containers"},"content":{"rendered":"<p><span style=\"float: none;background-color: #ffffff;color: #333333;font-family: Segoe UI,'Segoe UI Web Regular','Segoe UI Regular WestEuropean','Segoe UI',Tahoma,Arial,Roboto,'Helvetica Neue',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size: 16.93px;font-style: normal;font-variant: normal;font-weight: 400;letter-spacing: normal;text-align: left;text-decoration: none;text-indent: 0px\">Premier Developer Consultant <\/span><a href=\"https:\/\/www.linkedin.com\/in\/randyrpatterson\/\" target=\"_blank\" rel=\"noopener\">Randy Patterson<\/a><span style=\"float: none;background-color: #ffffff;color: #333333;font-family: Segoe UI,'Segoe UI Web Regular','Segoe UI Regular WestEuropean','Segoe UI',Tahoma,Arial,Roboto,'Helvetica Neue',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size: 16.93px;font-style: normal;font-variant: normal;font-weight: 400;letter-spacing: normal;text-align: left;text-decoration: none;text-indent: 0px\"> walks use through IIS remote management for Docker containers.<\/span><\/p>\n<hr \/>\n<p>When running IIS in a Windows Container, you configure it using PowerShell commands in your Dockerfile. While determining the correct PowerShell commands is not a difficult process it is inconvenient to verify the settings using the command line only. Sometimes, you just need a UI to quickly view and manage your IIS configuration.<\/p>\n<p>Fortunately, <em>Internet Information Services (IIS) Manager<\/em> for Windows allows remote management of IIS server including running in a container. However, it is not enabled by default for Windows Containers.<\/p>\n<p>Required Steps:<\/p>\n<ol>\n<li>Enable Remote Management in the Docker image<\/li>\n<li>Add an Admin user to the container image to allow IIS Remote Manager to login<\/li>\n<li>Connect to container using IIS Remote Manager<\/li>\n<\/ol>\n<h2>Enable Remote Management in the Docker Image<\/h2>\n<p>The first step to enable remote management is to install the Web-Mgmt-Service and configure it to automatically start when the container starts. Additionally, an admin user needs to be added to the container to allow the Remote IIS Manager UI to remotely connect and manage IIS<\/p>\n<p><code>FROM microsoft\/iis<\/code><\/p>\n<p><code>SHELL [ \"powershell\" ]<\/code><\/p>\n<p><code>#setup Remote IIS management<\/code><\/p>\n<p><code>RUN Install-WindowsFeature Web-Mgmt-Service; \\<\/code><\/p>\n<p><code>New-ItemProperty -Path HKLM:\\software\\microsoft\\WebManagement\\Server -Name EnableRemoteManagement -Value 1 -Force; \\<\/code><\/p>\n<p><code>Set-Service -Name wmsvc -StartupType automatic;<\/code><\/p>\n<p><code>#Add user for Remote IIS Manager Login<\/code><\/p>\n<p><code>RUN net user iisadmin <strong>Password~1234<\/strong> \/ADD; \\<\/code><\/p>\n<p><code>net localgroup administrators iisadmin \/add;<\/code><\/p>\n<h3>Step 1: Create an image using the above Dockerfile<\/h3>\n<p><code>docker build -t iisremote .<\/code><\/p>\n<p><img decoding=\"async\" width=\"976\" height=\"801\" class=\"wp-image-35245\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/c-users-ranpat-appdata-local-temp-snaghtml1e5790f.png\" alt=\"C:\\Users\\ranpat\\AppData\\Local\\Temp\\SNAGHTML1e5790f2.PNG\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/c-users-ranpat-appdata-local-temp-snaghtml1e5790f.png 976w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/c-users-ranpat-appdata-local-temp-snaghtml1e5790f-300x246.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/c-users-ranpat-appdata-local-temp-snaghtml1e5790f-768x630.png 768w\" sizes=\"(max-width: 976px) 100vw, 976px\" \/><\/p>\n<p>Figure : Build Image Sample Output<\/p>\n<h3>Step 2: Start the container<\/h3>\n<p><code>docker run --name remoteiis -d iisremote<\/code><\/p>\n<h3>Step 3: Display the IP Address of the running container<\/h3>\n<p><code>docker inspect --format '{{ .NetworkSettings.Networks.nat.IPAddress }}' remoteiis<\/code><\/p>\n<h2>Connect to IIS running in the container<\/h2>\n<p>Finally, start IIS Manager then right click on Start Page and click Connect to Server<\/p>\n<p><img decoding=\"async\" width=\"461\" height=\"338\" class=\"wp-image-35246\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/e-systemtemp-snaghtml202db6db-png.png\" alt=\"E:\\SystemTemp\\SNAGHTML202db6db.PNG\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/e-systemtemp-snaghtml202db6db-png.png 461w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/e-systemtemp-snaghtml202db6db-png-300x220.png 300w\" sizes=\"(max-width: 461px) 100vw, 461px\" \/><\/p>\n<p>If you do not have a \u201cStart Page\u201d or \u201cConnect to Server\u201d then install the IIS Remote Manager Plugin located here <a href=\"https:\/\/www.iis.net\/downloads\/microsoft\/iis-manager\">https:\/\/www.iis.net\/downloads\/microsoft\/iis-manager<\/a><\/p>\n<p>Enter the IP Address from Step 3 above<\/p>\n<p><img decoding=\"async\" width=\"673\" height=\"245\" class=\"wp-image-35247\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-109.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-109.png 673w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-109-300x109.png 300w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/p>\n<p>Next, enter the Remote IIS Manager Login from the Docker file in Step 1 above. The default is <strong><em>iisadmin\/Password~1234 <\/em><\/strong><\/p>\n<p><img decoding=\"async\" width=\"673\" height=\"292\" class=\"wp-image-35248\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-110.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-110.png 673w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-110-300x130.png 300w\" sizes=\"(max-width: 673px) 100vw, 673px\" \/><\/p>\n<p>If you get a certificate warning, click <strong>Connect<\/strong><\/p>\n<p><img decoding=\"async\" width=\"344\" height=\"238\" class=\"wp-image-35249\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-111.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-111.png 344w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-111-300x208.png 300w\" sizes=\"(max-width: 344px) 100vw, 344px\" \/><\/p>\n<p>On the next dialog, keep the default connection name and press the <strong>Finish <\/strong>button. You can now use IIS Manager to remotely configure IIS running in a container.<\/p>\n<p><img decoding=\"async\" width=\"930\" height=\"616\" class=\"wp-image-35250\" src=\"http:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-112.png\" srcset=\"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-112.png 930w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-112-300x199.png 300w, https:\/\/devblogs.microsoft.com\/premier-developer\/wp-content\/uploads\/sites\/31\/2019\/02\/word-image-112-768x509.png 768w\" sizes=\"(max-width: 930px) 100vw, 930px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When running IIS in a Windows Container, you configure it using PowerShell commands in your Dockerfile. While determining the correct PowerShell commands is not a difficult process it is inconvenient to verify the settings using the command line only. Sometimes, you just need a UI to quickly view and manage your IIS configuration.<\/p>\n","protected":false},"author":582,"featured_media":35251,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[2,29,314],"class_list":["post-35244","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web","tag-containers","tag-docker","tag-randy-patterson"],"acf":[],"blog_post_summary":"<p>When running IIS in a Windows Container, you configure it using PowerShell commands in your Dockerfile. While determining the correct PowerShell commands is not a difficult process it is inconvenient to verify the settings using the command line only. Sometimes, you just need a UI to quickly view and manage your IIS configuration.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/35244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=35244"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/35244\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/35251"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=35244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=35244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=35244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}