In order to debug why this issue occurs the following command is run on a container:
docker run -it <dockerImageName> dmesg
results in:
dmesg: read kernel buffer failed: Permission denied
Attempts
- Running
docker run -it <dockerImageName> sudo dmesg
returns the same issue
as Michael Hampton mentioned, containers are meant to run only single atomic service. As a matter of fact, one should understand that containers are not virtual machines but a single process by itself on your localhost.
Nevertheless, I got to know that, its a bit more harder to get SystemD working inside a container from here
After doing this, try to login to the container using
docker exec -it <container> /bin/bash
and then you could execute yoursystemctl
commands.