In order to deploy a CentOS container with systemd enabled to perform and use commands as systemctl you could do the following:
Download the official Centos image with systemd integrated from DockerHub and create a file name Dockerfile on your current working directory. The following dockerfile will install/enable httpd package with yum and systemctl.
FROM centos/systemd MAINTAINER "Your Name" firstname.lastname@example.org RUN yum -y install httpd; yum clean all; systemctl enable httpd.service EXPOSE 80 CMD ["/usr/sbin/init"]
Build your image:
docker build --rm --no-cache -t centos-sd-1 .
And then deploy a new container from your created image:
docker run --privileged --name centos-sd-1 -v /sys/fs/cgroup:/sys/fs/cgroup:ro -p 80:80 -d centos-sd-1
Verify that you can run successfully systemd commands:
[root@179a5c228835 /]# systemctl status httpd ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2020-04-05 13:18:06 UTC; 9min ago Docs: man:httpd(8) man:apachectl(8)