服务器重启后发现docker-compose的nginx重启失败: Error starting userland proxy: listen tcp 0.0.0.0:80: bind: addres
原创
©著作权归作者所有:来自51CTO博客作者gblfy的原创作品,请联系作者获取转载授权,否则将追究法律责任
服务器重启后执行docker-compose up -d报错:
Starting nginx ...
php is up-to-date
Starting nginx ... error
ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint nginx (b2a83540af157cc42157760afe9aec5f8876fbeeb9b495bda3454de89693d70f): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in
原因:
根据提示Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
,知道是端口被占用了, 通过netstat查看占用端口的是本机nginx, 杀掉本机的nginx后重新启动docker的就行了
解决:
1: 找到占用端口的程序netstat -anp|grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1061/nginx: worker
tcp 0 0 172.18.32.189:80 23.234.41.123:22894 SYN_RECV -
tcp 0 0 172.18.32.189:80 103.68.67.189:4633 SYN_RECV -
tcp 0 0 172.18.32.189:80 23.234.44.71:64802 SYN_RECV -
tcp 0 0 172.18.32.189:80 103.73.88.5:22476 SYN_RECV -
2: 杀掉进程
再执行docker-compose up -d
就成功了
Starting nginx …
Starting nginx … done