This is a classic docker issue. The start of the process should be carried out in the foreground, otherwise the container simply stops.
So, in order to be able to do this, you can use the startervice script in your service:
#!/usr/bin/sh service httpd start # Tail the log file tail -f /var/log/httpd/access_log # Alternatively, you can tail any file or even /dev/null #tail -f /dev/null
Please note that there are other ways to resolve them. One way is to use a supervisord that supports your processes. The supervisor approach is cleaner and lollipop than the tail -f approach, and I personally would prefer this alternative.
Another alternative is simply that you do not start httpd as a service, but instead provide the -DFOREGROUND . This will force httpd to be attached to the shell (and not fork for the background process).
/usr/sbin/httpd -DFOREGROUND
For more information about http in foreground mode, select question .
source share