CentOS / CentOS-Dockerfiles

Dockerfiles for various common implementations
GNU General Public License v2.0
1.86k stars 1.25k forks source link

D-Bus connection error when running systemctl inside container? #207

Open gargworld opened 4 years ago

gargworld commented 4 years ago

When I run systemctl command inside the container, I get D-Bus connection error root@3924d7bb5e59 /]# systemctl status httpd Failed to get D-Bus connection: Operation not permitted

can someone help or suggest what am I doing wrong.

tolland commented 3 years ago

Probably need to start the container privileged

Pythonov commented 2 years ago

This worked for me:

Dockerfile:

FROM centos/systemd:latest RUN yum -y install openssh-server openssh-clients CMD ["/bin/bash", "-c", "/usr/sbin/init"]

Part of docker-compose: service_test: build: dockerfile: service_dockerfile cap_add: [NET_ADMIN] privileged: true container_name: service_test hostname: service_test