docker run centos 7 with systemd

[root@ddf8f9b86831 /]# systemctl
Failed to get D-Bus connection: Operation not permitted

To fix use:

sudo docker run --name ccc1 -it --cap-add=SYS_ADMIN -e "container=docker" -ti -d -v /sys/fs/cgroup:/sys/fs/cgroup centos:7 /usr/sbin/init

or

sudo docker run --name ccc2 --privileged -ti -d milcom/centos7-systemd /usr/sbin/init

Leave a Reply

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