Heim > Fragen und Antworten > Hauptteil
[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
不是很确定,但是和docker的端口映射应该是没关系的,docker的关系映射相当于是再virtual box里面配了一个端口匹配规则,不会占用这个端口的,相当于外部端口转发到内部容器端口里。
所以你这个错误应该是docker内部端口被占了。试一下lsof -i :80看看
怪我咯2017-04-24 16:01:58
题主可以进入nginx的docker container实例,查看一下nginx是否已经启动:
ps -ef | grep nginx
# or
netstat -ntpl | grep 80
如果已经启动,则不需要在重复启动了