服务器重启后执行docker-compose up -d报错:
Starting nginx ...
php is up-to-date
Starting nginx ... errorERROR: 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 use
原因:
根据提示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: 杀掉进程
kill -9 1061
再执行docker-compose up -d
就成功了
Starting nginx …
Starting nginx … done