Windows Version: Windows Server 2016
Docker for Windows Version: 18.09.0
I try to follow the steps in https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-images
I have a Docker file on c:\Build:
FROM microsoft/iis
RUN echo "Hello World - Dockerfile" > c:\inetpub\wwwroot\index.html
Please note that I have tried using FROM microsoft/iis:10.0.14393.206
as well
So, I ran using powershell with admin privilege:
docker build -t imagename c:\Build
Then I ran:
docker run -d -p 8000:80 --name container imagename ping -t localhost
All of the above steps are fine, but I cannot access the website,
I tried every combination like: the ip address from ipconfig:8000 or 80; the ip address from inspect :8000 / 80. Please note that I had also set up Firewall to allow port 8000 as well
But it all failed.
Then, I went to the Internet and found that I can actucally call the bash. therefore, I ran exec, however, there was something strange happened:
I am not sure whether it means the container is not worknig? But the inspect and container ls show it should be working.
I really cannot find any solution from the Internet
Any advice would be helpful, thanks
UPDATE: I got it to work with the following configuration below, and with remote IIS access. Make sure that firewall is not blocking docker to your local ip's. Also, the app in our case is part of a website, so we need to use Webadministration to deploy it as an application to make it work. Logs and everything else is working now and we have a running sample.
I been playing as well with the docker container and I been having similar issues deploying. I am using a server core image instead as it has full fledge powershell on it, but I have my dockerfile defined like this to build the image at the moment doing tests because the application seems to not start. the app is not on core yet but will migrate to it soon to make the working image smaller. Another thing to note from this sample, the application pool is not getting created even tho its being defined on my commands. With this you can connect remotely with the iis remote management tool and check how is the server setup up to this point inside the docker.:
##Pull the base image to use
FROM mcr.microsoft.com/windows/servercore/iis
#Enable verbose output in case of errors
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
#install all needed features of IIS
RUN Install-WindowsFeature -name Web-Server -IncludeManagementTools ;\
Install-WindowsFeature -name Web-Basic-Auth ;\
Install-WindowsFeature -name Web-Windows-Auth ;\
Install-WindowsFeature -name Web-Net-Ext45 ;\
Install-WindowsFeature -name Web-ISAPI-Ext ;\
Install-WindowsFeature -name Web-ISAPI-Filter ;\
Install-WindowsFeature -name Web-WHC ;\
Install-WindowsFeature NET-Framework-45-ASPNET ; \
Install-WindowsFeature Web-Asp-Net45 ;\
Install-WindowsFeature -Name Web-Mgmt-Service ;\
Install-WindowsFeature -name Web-Mgmt-Tools ;\
Install-WindowsFeature -name Web-Mgmt-Compat ;\
Install-WindowsFeature -name Web-Scripting-Tools ;\
Dism /online /enable-feature /featurename:IIS-ManagementService /all ;\
##Still inside the same run command, enable remote management for IIS on docker
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WebManagement\Server -Name EnableRemoteManagement -Value 1 -Force ;\
Get-Service -Name WMSVC | Start-Service ;\
Set-Service –Name WMSVC –StartupType 'Automatic' ;\
##In the same run Command add the user and password for IIS remote management
net user myuser superP@ss123 /ADD ;\
net localgroup administrators myuser /add
COPY . myapp
RUN New-WebAppPool myapp
#The configStore is an application of a website, so add it as such to the service
RUN Import-Module WebAdministration; Get-Module ;\
New-Item 'IIS:Sites\Default Web Site\myapp' -physicalPath 'c:\myapp' -ApplicationPool 'myapp' -type 'Application'
EXPOSE 51329 80
The other question I have no answer is if we can actually assign a memory size to the docker images on creation and not just the standard by the owner.