1

I'm still at the beginning with Docker and I have problems when creating a container. I need to create a container from CentOS7, httpd24-httpd, PHP7.2. However, when starting the httpd24-httpd I already have a problem. The call is made through Docker-compose. Here is the dockerfile:

FROM centos:7

# Install httpd24
RUN yum -y update
RUN yum -y install centos-release-scl-rh
RUN yum -y install httpd24-httpd

EXPOSE 80

# Start httpd24
CMD ["systemctl","start","httpd24-httpd"]

The docker-compose file:

version: '3.1'

services:
    centos:
        build: ./centos7
        ports:
            - "80:80"
        volumes: 
            - .:/code
            - ./centos7/www:/var/www/html

Error:

centos_1 | Failed to get D-Bus connection: Operation not permitted

Unfortunately, I don't know how to make this work. Can you give me some tips here on how to solve this?

BR

Reiner

1 Answer 1

0

systemctl typically not enabled in docker container, so you should directly call command.

For you, next Dockerfile should work:

FROM centos:7

RUN yum -y update
RUN yum -y install httpd

EXPOSE 80

CMD /usr/sbin/apachectl -DFOREGROUND

Execution:

$ docker build -t abc:1 .
$ docker run -idt -p 80:80 --name trial abc:1

Verify the package version:

$ docker exec -it trial rpm -qa httpd
httpd-2.4.6-97.el7.centos.x86_64

Verify the web page be accessable:

$ docker exec -it trial curl http://localhost

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.