nignx - docker内nginx 80端口被占用
天蓬老师
天蓬老师 2017-04-24 15:59:58
0
4
1231

[root@8f52078ea4e6 config]# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

docker容器配置的端口对应关系: 22/tcp, 0.0.0.0:80->80/tcp

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(4)
PHPzhong

Not sure, but it should have nothing to do with docker's port mapping. Docker's relationship mapping is equivalent to configuring a port matching rule in the virtual box. This port will not be occupied. It is equivalent to forwarding the external port to the internal container port. .
So your error should be that the internal port of docker is occupied. Try lsof -i :80 and see

小葫芦

What mirror are you using?
If it is the official nginx, the nginx process has already been started. At this time, of course you cannot start another one on 80

刘奇

The subject can enter the docker container instance of nginx and check whether nginx has been started:

ps -ef | grep nginx
# or
netstat -ntpl | grep 80

If it has already been started, there is no need to start it again

我想大声告诉你


You are already in the container, right? After your nginx container is started, port 80 is already up. If you are running nginx, it must show that it is occupied.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!