service failed to start after docker restart

I have created a docker container with httpd service installed in it. But whenever I restart the container, the httpd service does not come back online. Even I have added the service in chkconfig . The httpd status shows as “httpd dead but pid file exists”

I have checked docker container log

{"log":"[Thu Apr 27 02:38:59 2017] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)\r\n","stream":"stdout","time":"2017-04-27T03:32:12.168314399Z"}
{"log":"[Thu Apr 27 02:38:59 2017] [notice] Digest: generating secret for digest authentication ...\r\n","stream":"stdout","time":"2017-04-27T03:32:12.168317105Z"}
{"log":"[Thu Apr 27 02:38:59 2017] [notice] Digest: done\r\n","stream":"stdout","time":"2017-04-27T03:32:12.168319918Z"}
{"log":"[Thu Apr 27 02:38:59 2017] [notice] Apache/2.2.31 (Unix) DAV/2 configured -- resuming normal operations\r\n","stream":"stdout","time":"2017-04-27T03:32:12.168322653Z"}
{"log":"^C\r\n","stream":"stdout","time":"2017-04-27T03:32:45.680664198Z"}

But it’s not showing any useful information to fix the issue.

My docker is running AWS EC2 server.

Can anybody help me on this?

Answer

I’ve had this problem using the image fauria/lap. It seems that the container is not gracefully ending the httpd process, therefore the service can’t start the second time the container is up because of the pid file.

Our solution was to implement an intermediary docker-entrypoint2.sh that removes the file and calls the original docker-entrypoint.sh.

In our case, this behavior was inherited from the centos:7 and the service management system that comes with it.

Attribution
Source : Link , Question Author : Techiescorner , Answer Author : Gustavo Kawamoto

Leave a Comment