Windows Version: Windows Server 2016
Docker for Windows Version: 18.09.0
I try to follow the steps in https://docs.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
After a month, I have another way to get to the container's IIS...
I am going to post the answer here, in case someone encounters similar issues
The setup greatly relates to https://blogs.msdn.microsoft.com/containerstuff/2017/02/14/manage-iis-on-a-container-with-the-iis-admin-console/
The difference is:
To fully install IIS in a container, use the following DockerFile:
(There are some steps missed in the document, you cannot have wmsvc and IIS admin services installed without the following lines included in the Dockerfile below)
Docker run
the image with -it /Docker attach
the containerstart container's powershell by typing
powershell
running
Get-service
to see if IISadmin, w3svc and wmsvc are there.It will show that wmsvc is not started (strangely, even I run
sc config wmsvc start=auto
in DockerFile still does not work)net start
the serviceuse host's IIS to connect to the container's IIS (similar to the step given by the link above)
It should be able to connect to the container from host and now you have successfully implemented a web application in a container.
PS. Note that firewall may block the remote management process
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.:
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.