Failed to get D-Bus connection – httpd service in Docker container

I am creating a Dockerfile for PostgreSQL with CentOS7 as the base image. I am trying to start httpd service with the following command in the container,

service httpd start

and i get the following error:

  • Docker can't exec init scripts while run Docker start command
  • I can't start the docker service with iptables error
  • Start a service inside docker CentOS 7 container
  • Progressively migrating to Docker in production
  • Set EnableSendfile Off from Dockerfile
  • How to restart apache2 without crashing docker container?
  • Redirecting to /bin/systemctl start  httpd.service
    Failed to get D-Bus connection: No connection to service manager.

    The log file directory /var/log/httpd is also empty. I guess this is the problem with Docker CentOS7 image. Any help appreciated.

  • Multiple vhosts on one and the same docker container
  • How to install docker on CentOS 7?
  • Receiving a Connection Refusal in Zeppelin
  • Automatic Docker stop after running in CentOS [closed]
  • Curl connection refused between applications on Docker container
  • Access a docker containers own localhost inside that container — php apache
  • One Solution collect form web for “Failed to get D-Bus connection – httpd service in Docker container”

    I have run into this a well.
    It might not be the best way, but you can find a copy of the /etc/init.d/httpd file from another computer. copy that into the container in /etc/init.d
    then run
    chkconfig --level 345 httpd on

    then you will be able to use either
    /etc/init.d/httpd start or service httpd start

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.