1
votes

I have a windows container running the microsoft/iis base image, with Docker Desktop for Windows

I built the image using the following:

Command:

docker build -t test-iis-image .

File:

FROM microsoft/iis

EXPOSE 8080'

I then run a container using:

Command:

docker run -d -p 8080:8080 test-iis-image

I got the IP address of the container (e.g. 172.18.167.181)

added a route:

Command

route /P add 172.0.0.0 MASK 255.0.0.0 10.0.75.1

and then tried to connect to the container using the following url:

http://172.18.167.181:8080/

I am expecting to see the default IIS web page, but all I get is:

The following error was encountered while trying to retrieve the URL: > > > http://172.18.167.181:8080/

Connection to 172.18.167.181 failed.

The system returned: (110) Connection timed out

The remote host or network may be down. Please try the request again.

However, when i ping the ip address it seems to find the container:

ping 172.18.167.181

Pinging 172.18.167.181 with 32 bytes of data:

Reply from 172.18.167.181: bytes=32 time<1ms TTL=128

Reply from 172.18.167.181: bytes=32 time<1ms TTL=128

Reply from 172.18.167.181: bytes=32 time=1ms TTL=128

Reply from 172.18.167.181: bytes=32 time<1ms TTL=128

Ping statistics for 172.18.167.181:

Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:

Minimum = 0ms, Maximum = 1ms, Average = 0ms

1

1 Answers

0
votes

I think it not working because the default port inside the container is not 8080. It's 80. So change your

docker run -d -p 8080:8080 test-iis-image

to

docker run -d -p 8080:80 test-iis-image

For more details refer to https://hub.docker.com/r/microsoft/iis/

Also you can view one of the main Dockerfiles here

https://github.com/microsoft/iis-docker/blob/main/windowsservercore-ltsc2022/Dockerfile