试图在个人Mac和docker数字海洋液滴上启动openresty ( https://github.com/3scale/docker-openresty ),但得到了一个错误:
DEBG 'openresty' stderr output:
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
Con图:
1) Dockerfile
FROM 3scale/openresty
ADD openresty.conf /etc/supervisor/conf.d/
ADD . /var/www
CMD ["supervisord"]
2) Openresty.conf
[program:openresty]
command=/opt/openresty/nginx/sbin/nginx -p /var/www/ -c config/nginx.conf
autorestart=true
3) config/nginx.conf
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location / {
default_type text/html;
content_by_lua '
ngx.say("<p>hello, world</p>")
';
}
}
}
我如何启动它:
docker build -t resty_docker .
docker run resty_docker
结果
2014-11-02 11:27:01,232 CRIT Supervisor running as root (no user in config file)
2014-11-02 11:27:01,233 WARN Included extra file "/etc/supervisor/conf.d/openresty.conf" during parsing
2014-11-02 11:27:01,233 WARN Included extra file "/etc/supervisor/conf.d/cron.conf" during parsing
2014-11-02 11:27:01,233 WARN Included extra file "/etc/supervisor/conf.d/arping.conf" during parsing
2014-11-02 11:27:01,233 WARN Included extra file "/etc/supervisor/conf.d/redis.conf" during parsing
2014-11-02 11:27:01,260 INFO RPC interface 'supervisor' initialized
2014-11-02 11:27:01,260 WARN cElementTree not installed, using slower XML parser for XML-RPC
2014-11-02 11:27:01,260 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2014-11-02 11:27:01,260 INFO supervisord started with pid 1
2014-11-02 11:27:02,269 INFO spawned: 'cron' with pid 7
2014-11-02 11:27:02,272 INFO spawned: 'arping' with pid 8
2014-11-02 11:27:02,275 INFO spawned: 'redis' with pid 9
2014-11-02 11:27:02,277 INFO spawned: 'openresty' with pid 10
2014-11-02 11:27:02,302 DEBG fd 20 closed, stopped monitoring <POutputDispatcher at 34498968 for <Subprocess at 34067088 with name openresty in state STARTING> (stdout)>
2014-11-02 11:27:02,302 DEBG fd 24 closed, stopped monitoring <POutputDispatcher at 34499328 for <Subprocess at 34067088 with name openresty in state STARTING> (stderr)>
2014-11-02 11:27:02,302 INFO exited: openresty (exit status 0; not expected)
2014-11-02 11:27:02,303 DEBG received SIGCLD indicating a child quit
2014-11-02 11:27:03,306 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2014-11-02 11:27:03,306 INFO success: arping entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2014-11-02 11:27:03,306 INFO success: redis entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2014-11-02 11:27:03,308 INFO spawned: 'openresty' with pid 19
2014-11-02 11:27:03,318 DEBG 'openresty' stderr output:
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014-11-02 11:27:03,820 DEBG 'openresty' stderr output:
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014-11-02 11:27:04,329 DEBG 'openresty' stderr output:
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
2014-11-02 11:27:04,329 INFO success: openresty entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2014-11-02 11:27:04,831 DEBG 'openresty' stderr output:
nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)
发布于 2014-11-04 08:03:15
好的,问题不是ONBUILD CMD ["supervisord", "-n"]
,而是nginx去后台和主管杀死它。
在将daemon off;
添加到nginx.conf之后,问题就消失了。
发布于 2014-11-02 15:20:21
父容器3 3scale/openresty有行ONBUILD CMD ["supervisord", "-n"]
--这意味着sypervisord已经在运行(关于ONBUILD的尾盘,请参阅这里 )。当您的监督命令运行时,它会发现冲突。
https://stackoverflow.com/questions/26700198
复制相似问题