Running a program as a service or directly, what’s the difference

This might be a bit of a confused question…

I’ve recently started playing around with docker and am trying to setup a basic lamp server.

I have a docker image of centos with httpd, php, and mysql.

However, in a docker container I can’t start services in the way I would usually do via systemd / service.

I can get httpd running directly via /usr/sbin/httpd

So then what if any is the difference in running httpd via /usr/sbin/httpd rather than via systemctl start httpd?

Is there a ‘proper’ way to stop or restart httpd? – I thought I could just kill the process but it appears to launch about 10 apache processes.

I appreciate this isn’t a particularly well focused question but any pointer to relevant material would be gratefully received.


You cannot use systemctl If your PID 1 is not systemd. You can find your PID 1 with ps -q 1.

Being able to start and stop services the normal way is one advantage mentioned in this article about Running systemd in a non-privileged container. Others are logging or tracking of child processes as described in Andrei’s answer.

Leave a Reply

Your email address will not be published. Required fields are marked *