在监督器中运行docker中的node和nginx

我正在尝试在Docker容器中设置node和nginx,使用supervisor启动和监视这两个进程。 我有一个主pipeconf文件,启动nginx和节点。

问题是,当我尝试使用supervisorctl来访问他们没有find的服务。 所以我认为我一定是做错了什么。

supervisor.conf

[supervisord] nodaemon=true [program:nodeServer] directory=/app/backend command=/nodejs/bin/node app.js autostart=true autorestart=unexpected user=www-app startsecs=10 stdout_logfile=/var/log/repositive.io/supervisor.log redirect_stderr=true [program:nginx] command=/usr/sbin/nginx stdout_events_enabled=true stderr_events_enabled=true 

dockerfile

 FROM google/debian:wheezy # update and install nginx and supervisor RUN apt-get update -y && \ apt-get install --no-install-recommends -y -q \ curl python build-essential git ca-certificates nginx-extras supervisor # install node RUN mkdir /nodejs && \ curl http://nodejs.org/dist/v0.10.32/node-v0.10.32-linux-x64.tar.gz | \ tar xvzf - -C /nodejs --strip-components=1 ENV PATH $PATH:/nodejs/bin # setup db RUN apt-get install -y postgresql USER postgres RUN /etc/init.d/postgresql start && \ createuser repositive -S -D -R && \ createdb --owner=repositive --port=5432 repositive && \ createdb --owner=repositive --port=5432 repositive-testing # init app USER root RUN mkdir -p /var/www/repositive.io RUN mkdir -p /var/log/repositive.io RUN chown -R www-data:www-data /var/www/repositive.io WORKDIR /app ONBUILD ADD nginx.conf /etc/nginx/sites-available/default ONBUILD ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf ONBUILD ADD ../ /app ONBUILD RUN npm install ENV NODE_ENV production EXPOSE 80 CMD ["/usr/bin/supervisord"] 

现在,我尝试通过构build映像来访问其中一个服务,而不是以交互方式运行它:

 sudo docker run -t -i timrich/api.repositive.io:V0.0.1 /bin/bash root@b16b20f8f1b4:/app# /usr/bin/supervisord root@b16b20f8f1b4:/app# supervisorctl status nginx No such process nginx 

但是没有find主pipe的工作

你有没有考虑在不同的容器中运行这两个服务?

当你使用docker run … [command]运行你的Docker容器时,你会覆盖dockerfile(supervisord)中指定的默认命令。 尝试启动它没有命令选项,你的情况“/ bin / bash”。 这意味着在你的情况下,你盯着bash而不是supervisord,这意味着没有进程supervisord开始。

如果你想检查是否一切正常,你可以使用docker日志或docker exec 。