Failed to get D-Bus connection: Operation not permitted

after initializing a container using following command:

 docker run -it --name testweb centos:latest /bin/bash

and doing yum update -y && yum install -y openssh-server httpd 

I do: systemctl start httpd , this gives following error:


Failed to get D-Bus connection: Operation not permitted

please suggest 

regards,AC

  • post-author-pic
    Keith T
    12-03-2018

    Containers aren't designed to run multiple processes so they don't run systemd by default, which is where this error is coming from. It is possible to run systemd, but you'll need to create a custom image based on `centos:latest`.

  • post-author-pic
    Anuraag C
    12-04-2018

    Hi, 

    I used the base image as centos:latest only, however please guide on how to customize this. Secondly, all through the lecture videos, systemctl is being used to activate a service. 
    Regards,
    AC

Looking For Team Training?

Learn More