The sink host cannot access docker’s container (nginx)

  docker, question

Start container normally

[root@iZ287mq5dooZ data]# docker run --name nginx11 -p 80:80 -d -v /www:/www -v /data:/data --link php7:php7 -it centos/nginx:v1.11.5
 [root@iZ287mq5dooZ data]# docker ps
 CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                         NAMES
 9078f7a9a355        centos/nginx:v1.11.5   "/usr/local/nginx/sbi"   6 minutes ago       Up 6 minutes>80/tcp, 443/tcp   nginx11
 e15ebb8a53b2        centos/php:v7.0.12     "/usr/local/php/sbin/"   2 hours ago         Up 2 hours>9000/tcp        php7

Host access, unable to access normally, returned Empty reply from server, unable to find reason all the time

[root@iZ287mq5dooZ data]# curl
 curl: (52) Empty reply from server
 [root@iZ287mq5dooZ data]# curl
 curl: (56) Recv failure: Connection reset by peer

However, access into the container can be returned normally, and bms is the returned content

[root@iZ287mq5dooZ data]# docker inspect --format "{{ .State.Pid }}"  9078f7a9a355
 [root@iZ287mq5dooZ data]# nsenter --target 22063 --mount --uts --ipc --net --pid
 [root@9078f7a9a355 /]# curl http://localhost

This method of access is not acceptable either.

[root@iZ287mq5dooZ data]# docker inspect --format='{{.NetworkSettings.IPAddress}}' 9078f7a9a355
 [root@iZ287mq5dooZ data]# curl
 curl: (7) Failed connect to;  Connection refused

May I ask everyone what is the thinking for dealing with this problem?

When writing nginx.conf, the individual writes nginx’s configured listening port incorrectly and changes it to

server {
 listen       80;  //I wrote, and other configurations are slightly different.