系统:Ubuntu 14.04 x64
1,在本地虚拟机搭建的Ubuntu14.04 配置的docker-compose.yml 相同端口和不同端口的转发,都能访问
2,在服务器上使用相同的配置文件, docker-compose up -d 启动之后,
在服务器上使用 curl http://127.0.0.1:80 能访问, 使用 curl http://服务器IP:80,就不能访问,
如果把端口改成 81:80 通过http://服务器IP:81 也能访问
netstat 看过端口,80没有被占用
docker-compose.yml 配置
ports:
- "80:80"
- "3001:3000"
服务器端:
0.0.0.0:80->80/tcp
0.0.0.0:3001->3000/tcp
Can port 3001 be accessed?
It should be that port 80 is blocked by the firewall...
Install nmap on another server
Then execute the following command to check whether port 80 is blocked:
192.168.59.1 is the IP of the first server.
If port 80 is blocked, the output status is filtered
If port 80 is occupied, it will prompt that the port is occupied when starting the container. Therefore, if the container starts normally, the problem of port occupation can be basically eliminated. In addition, port 81 is normal, but there is a problem with port 80, which means that port 80 may be specially taken care of. Although the firewall of the Ubuntu system is turned off by default, it is best to check it.
1. Check the local firewall of the server
2. Contact the server provider and ask if 80 is blocked