If you are trying to execute the command
$systemctl start docker inside of a Docker container started by the command as for example
$docker run -i -t myImage /bin/bash then probably you are facing the following message.
System has not been booted with systemd as init system (PID 1). Can’t operate.
Note that the default profile permissions used to start a docker container will not allow this operation. For a further understanding check the Seccomp security profiles for Docker section in the Docker docs.
Also, a container is relatively well isolated from other containers and its host machine. You can control how isolated a container’s network, storage, or other underlying subsystems are from other containers or from the host machine. Then, you need to mount the host’s
/sys/fs/cgroup volume in order to persist the resource usage for a set of processes to be allowed to manage them inside of a container. To understand better it sees the blog post Docker Internals and the official documentation
Following an example regards to how to start a Fedora image where you will be able to manage the process.
docker run -d –name fedora28 -e=container=docker –stop-signal=SIGRTMIN+3 –cap-add=SYS_ADMIN –security-opt=seccomp:unconfined -v /sys/fs/cgroup:/sys/fs/cgroup:ro fedora /sbin/init
--name will define the name of the container which can be checked as follows.
After perform the above steps you can access the container started and manage the process via systemctl as follows.
docker exec -it fedora28 bash
Note, also that when this container is started you are executing the
/sbin/init, linux, SO initialization script in order to set up this configuration.