unable to run Apache/php from docker container

My requirement is using openface i need to train the dataset(images) and test each input image from webinterface (PHP) and all this activity should run from docker container.

I am able to achieve the above requirment on ubuntu machine. we are trying to install the complete setup(apache/php & openface) in docker. currently we are unable to invoke the html files from apache server using docker

  • CMake autogenerated Makefile on ubuntu 16.04 docker image prepending “//” to targets
  • How do I configure boot2docker to start my containers on boot?
  • docker on centos that has no internet, rpm package dependency issue
  • Docker Neo4j Container keeps stopping - how to debug?
  • Moving Docker Containers Around
  • docker elevate user priviledges
  • The following the docker file used to import the project into docker and install apache/PHP. Please let me know if any changes need to be done in the dockerfile.

    FROM ubuntu:16.04
    RUN apt-get update && \
          apt-get -y install sudo
    RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
    ADD opencv-3.0.0 /
    ADD openface_setup.sh /
    RUN /openface_setup.sh
    ADD openface_work /
    RUN apt-get update && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y install \
    apache2 php7.0 libapache2-mod-php7.0 curl lynx-cur
    RUN a2enmod php7.0
    RUN a2enmod rewrite
    RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.0/apache2/php.ini
    RUN sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php/7.0/apache2/php.ini
    ENV APACHE_RUN_USER www-data
    ENV APACHE_LOG_DIR /var/log/apache2
    ENV APACHE_LOCK_DIR /var/lock/apache2
    ENV APACHE_PID_FILE /var/run/apache2.pid
    EXPOSE 8080
    VOLUME /var/www/html # **my PHP/html files are located here. In the docker container the html/php files are not reflecting**
    ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf
    CMD /usr/sbin/apache2ctl -D FOREGROUND

    Once the container is started i want the test.html(located in /var/www/html) to be running.

    FYI :

    1. command to created docker image

      sudo docker build -t myname/apache-test .

    2. command to start the docker container

      docker run -p 8080:80 -d <imageid>

  • How to deploy django 1.8 on Elastic Beanstalk using Docker
  • How to solve `Building CXX object src/CMakeFiles/qpidcommon.dir/qpid/sys/posix/Condition.cpp.o` while compiling qpid-cpp within Docker Alpine?
  • Unable to login to artifactory docker repository
  • How to duplicate container using existing images
  • Storring and pulling meta-information of a docker image
  • How to configure log-driver in kubernetes pods file?
  • One Solution collect form web for “unable to run Apache/php from docker container”

    I’d suggest to use the official PHP image with a pre-installed Apache installation.

    Your project might look like this:

    ├── Dockerfile
    └── src
        └── index.php

    while your Dockerfile consists of this:

    FROM php:7.1-apache
    # now RUN here your commands to install openface etc.

    and your index.php could look like this:

    <?php phpinfo();

    Then build the image:

    docker build -t myapache .
    docker run --rm -p 8080:80 -v $(pwd)/src:/var/www/html myapache

    http://localhost:8080 shows the php-info page.

    You can extend the image to your needs and it’s much simpler than your approach. Hope this might help.

    If you do not need to install anything else, you can directly use the php:7.1-apache image when creating a new container.

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