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:

  • Run apache in both host machine and docker container on 80 port
  • Changing permissions of added file to a Docker volume
  • Starting a service inside of a Dockerfile
  • Using docker bridge network IP to access vhost in apache container
  • Install nodejs using docker
  • Share folders Docker
  • 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.

  • Starting a service inside of a Dockerfile
  • Docker API version with Docker login in CentOS 7
  • docker PHP-APACHE "You don't have permission to access / on this server”
  • Install docker-volume-netshare on Linux AMI
  • Dockerfile privileged flag for Docker container (Needed because of Apache error ulimit ) AWS
  • Dockerfile: Docker build can't download packages: centos->yum, debian/ubuntu->apt-get behind intranet
  • 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.