Most likely a different application already runs at port 80. You'll have to forward your web site to a different port, eg:
docker run -d -p 5000:80 --name myapp myasp
And point your browser to http://localhost:5000
.
When you start a container you specify which inner ports will be exposed as ports on the host through the -p
option. -p 80:80
exposes the inner port 80
used by web sites to the host's port 80.
Docker won't complain though if another application already listens at port 80, like IIS, another web application or any tool with a web interface that runs on 80 by default.
The solution is to:
- Make sure nothing else runs on port 80 or
- Forward to a different port.
Forwarding to a different port is a lot easier.
To ensure that you can connect to a port, use the telnet command, eg :
telnet localhost 5000
If you get a blank window immediatelly, it means a server is up and running on this port. If you get a message and timeout after a while, it means nobody is running. You anc use this both to check for free ports and ensure you can connect to your container web app.
PS I run into this just a week ago, as I was trying to set up a SQL Server container for tests. I run 1 default and 2 named instances already, and docker
didn't complain at all when I tried to create the container. Took me a while to realize what was wrong.
-p
parameter, eg-p 18000:80
will expose a web app at127.0.0.1:80
. For specifics, post the parameters you used to create the container – SybylDocker
? How long did you spend trying to find out how to talk to it? – SybylWindows 10
but eg10.0.16299.15
. You can get this by typingver
at a command line. For docker:docker version
. Do you already run something at port 80? Perhaps IIS with a default site? Have you tried changing the forwarded port, eg to18000
with-p 18000:80
and connect tolocalhost:18000
? – Sybylnothing works
that you tried? As for the tutorial, you don't need these steps anymore, VS templates already provide Docker support. You can just create a new web app from the template and run it. – Sybyl