0

Following is the output for command docker run -p 9898:80 myContaineron stdout:

2019-01-03 17:23:08,600 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-01-03 17:23:10,109 INFO exited: nginx (exit status 1; not expected)
2019-01-03 17:23:11,115 INFO spawned: 'nginx' with pid 87
2019-01-03 17:23:12,176 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-01-03 17:23:13,681 INFO exited: nginx (exit status 1; not expected)
2019-01-03 17:23:14,683 INFO spawned: 'nginx' with pid 88
2019-01-03 17:23:15,710 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-01-03 17:23:17,214 INFO exited: nginx (exit status 1; not expected)
2019-01-03 17:23:18,218 INFO spawned: 'nginx' with pid 89
2019-01-03 17:23:19,281 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-01-03 17:23:20,787 INFO exited: nginx (exit status 1; not expected)
2019-01-03 17:23:21,788 INFO spawned: 'nginx' with pid 90
2019-01-03 17:23:22,840 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-01-03 17:23:24,344 INFO exited: nginx (exit status 1; not expected)
2019-01-03 17:23:25,346 INFO spawned: 'nginx' with pid 91
2019-01-03 17:23:26,361 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2019-01-03 17:23:27,869 INFO exited: nginx (exit status 1; not expected)

supervisord.conf:

[supervisord]
nodaemon=true

[program:nginx]
command=/usr/sbin/nginx

[program:php-fpm]
command=/usr/sbin/php-fpm -D

Dockerfile:

from centos
run yes | yum install epel-release -y
run yes | yum install nginx -y
run yes | yum install vim -y 
run yes | yum install php-fpm
run yes | yum install supervisor

copy supervisord.conf /etc/supervisord.conf
copy nginx.conf /etc/nginx/nginx.conf
copy index.html /usr/share/nginx/html
copy cal.php /usr/share/nginx/html
copy 404.html /usr/share/nginx/html

CMD ["/usr/bin/supervisord"]

I am able to access web-server from host machine and php code is also being processed by the php-fpm installed therein.

I am worried about the frequent restart required for nginx by supervisord. What is it that I am doing wrong?

PS: Please ask for details before downvoting the question. I have posted after enough research on my own. This is my last resort!!!

1

It looks like nginx is immediately exiting. That could be from a configuration file error, permission problem, etc, and the best way to find out is to run it by hand inside the container to make sure it starts and remains running. Given that this is nginx, at least one issue is that you are not starting it in the foreground. The standard way nginx is run in other containers is with:

nginx -g "daemon off;"

You can see this in the Dockerfile used to build nginx.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.