Docker: Container: CentOS7: Failed to get D-Bus connection: Operation not permitted
At the beginning, going to prepare a CentOS7 container for testing a website.
When to start the httpd service, got this error, however.
$ sudo systemctl start httpd
Failed to get D-Bus connection: Operation not permitted
Failed to get D-Bus connection: Operation not permitted
In fact, run any systemctl. Got the same failed.
Finally, found the answer:
docker run --privileged --name {container} -d {image} /sbin/init
docker run --privileged --name centos7 -d centos:7 /sbin/init
docker exec -ti centos7 bash
docker exec -ti centos7 bash
Update