Docker : Access to Services on Container2019/02/19
If you'd like to access to services like HTTP or SSH which is running on Containers as a daemon, set like follows.
|||For exmaple, run a container to use the container image which has IIS service like the example of here.|
# map the port of Host and the port of Container with [-p xxx:xxx]
docker run -t -d -p 8081:80 srv.world/iis cmd
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ce3bfb401c6e srv.world/iis "cmd" 32 seconds ago Up 27 seconds 0.0.0.0:8081->80/tcp blissful_nobel
# create a test page
docker exec ce3bfb401c6e powershell -c "Write-Output 'IIS on Docker Container' | Out-File -Encoding default C:\inetpub\wwwroot\index.html"
|||Verify the test page is shown normally to access to [localhost:8081] on Parent Host.|