Ngnix is not responding

Trying to find out a reason that prevents not responding from ngnix.
http://localhost returns “localhost refused to connect”.
There was a container run as recommended for testing:

docker run -d -p 80:80 --name webserver nginx

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
90cab05808d4 nginx “nginx -g 'daemon off” 12 seconds ago Up 10 seconds 0.0.0.0:80->80/tcp, 443/tcp webserver

Netstat does not show redirections from/to 80

$ docker version
Client:
Version: 1.12.6
API version: 1.24
Go version: go1.6.4
Git commit: 78d1802
Built: Wed Jan 11 00:23:16 2017
OS/Arch: windows/amd64

Server:
Version: 1.13.0
API version: 1.25
Go version: go1.7.3
Git commit: 49bf474
Built: Wed Jan 18 16:20:26 2017
OS/Arch: linux/amd64

$ docker info
Containers: 2
Running: 1
Paused: 0
Stopped: 1
Images: 10
Server Version: 1.13.0
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 154
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.43-boot2docker
Operating System: Boot2Docker 1.13.0 (TCL 7.2); HEAD : 5b8d9cb - Wed Jan 18 18:50:40 UTC 2017
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.858 GiB
Name: default
ID: JHPY:STVL:VRQP:KSHN:K6AG:MUGX:TANQ:26U5:7BTX:TESD:U5XQ:NRNT
Docker Root Dir: /mnt/sda1/var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 20
Goroutines: 27
System Time: 2017-04-16T17:05:31.692473842Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Labels:
provider=virtualbox
Insecure Registries:
127.0.0.0/8

from the docker ps output you posted, it appears that container was created 12 seconds prior and has only been up for 10 seconds? anything in docker logs? is there anything else by chance already listening on the host’s tcp port 80? perhaps try launching it on a non-standard port (eg -p 8080:80) and see if you can connect to it via port 8080

There was a check of possible listeners on 80 with netstat so no other listeners there.
Nginx run with other ports did not solve localhost response.
Docker was configured to use default machine with IP 192.168.99.100 in my case. I found that this IP was responding as ngnix server but not localhost. Docker forwards response of nginx to exposed IP.
The container itself open port number 80 by running -
$ docker run -d -p 80:80 --name webserver nginx

It might be some simple misconfiguration somewhere. Host PC is Win10 and Docker Quickstart as a terminal.

interesting. so just to make sure I understand what you are saying, your local machine running docker engine has an ip address of 192.168.99.100 and you can curl 192.168.99.100 from that box and see the default nginx message but if you curl localhost from that same box you get the ‘localhost refused to connect’ message?

so did some quick research as I don’t use windows and from this stackoverflow posting, it appears that you can’t use localhost on Windows at the moment - http://stackoverflow.com/questions/41154794/how-to-access-http-localhost-from-a-docker-container-in-windows

here’s another post that goes into more details regarding the issue - https://blog.sixeyed.com/published-ports-on-windows-containers-dont-do-loopback/

It seemed that something happened on Win10 networking. It was a try to check some setting of dev environment with docker on Win10. I will keep it in mind. The links to the same issue are worth reading. Thank you Kevin!