Suse + Docker + PHP

Hi,

I am creating a Docker image that has Apache and PHP. Everything seems to be going fine, but when I try to access my index.php the browser doesn’t open the page, it just tries to download it. This is my dockerfile:

FROM opensuse/leap

### INSTALL Apache, Apache modules, PHP, and dependencies ###
RUN \
zypper refs && zypper refresh && \
zypper --non-interactive install apache2 lynx w3m && \
zypper --non-interactive install php7 php7-fpm php7-curl php7-gd php7-intl php7-mysql apache2-mod_php7 php7-gettext php7-mbstring php7-zip php7-pgsql php7-phar php7-openssl php7-zlib php7-pecl php7-pecl php7-devel php7-fileinfo php7-json php7-APCu php7-xmlreader php7-xmlrpc php7-xmlwriter php7-ctype php7-dom php7-iconv php7-sqlite php7-pdo php7-tokenizer && \
zypper --non-interactive install apache2-mod_php7 && \
zypper --non-interactive install vim


##############################
RUN echo "<?php echo '<p>Hola Mundo</p>'; ?>" > /srv/www/htdocs/index.php
#RUN echo "Hola Mundo" > /srv/www/htdocs/index.html
##############################

EXPOSE 80

### START Apache modules ###
RUN a2enmod php7
RUN a2enmod headers
RUN a2enmod rewrite

#CMD [ "php", "-S", "0.0.0.0:80" ]
ENTRYPOINT ["/usr/sbin/httpd"]
CMD ["-D", "FOREGROUND"]

Thank you in advance

Answering myself:

fixed using “apachectl” as the entrypoint:

ENTRYPOINT ["apachectl"]
CMD ["-D", "FOREGROUND"]