[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
PHPz2017-04-24 16:01:58
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
高洛峰2017-04-24 16:01:58
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
怪我咯2017-04-24 16:01:58
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
我想大声告诉你2017-04-24 16:01:58
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.