Windows 2019
Sponsored Link

Docker : Access to Services on Container
If you'd like to access to services like HTTP or SSH which is running on Containers as a daemon, set like follows.
[1] For exmaple, use a Container which has IIS service.
# map the port of Host and the port of Container with [-p xxx:xxx]

PS C:\Users\Administrator>
docker run -t -d -p 8081:80 cmd

PS C:\Users\Administrator>
docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
ce3bfb401c6e       "cmd"               32 seconds ago      Up 27 seconds>80/tcp   blissful_nobel

# create a test page

PS C:\Users\Administrator>
docker exec ce3bfb401c6e powershell -c "Write-Output 'IIS on Docker Container' | Out-File -Encoding default C:\inetpub\wwwroot\index.html"
[2] Verify test page is shown normally to access to [localhost:8081] on Parent Host.
Matched Content