[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
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:
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.