I have my LAMP stack installed already before Docker's. And I am using this image to build and run my Docker's LAMP stack:
$ docker pull linuxconfig/lamp
After all are downloaded and installed:
$ docker run -it linuxconfig/lamp /bin/bash
root@2e80dfd55a6e:/# service apache2 start
[....] Starting web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
So at my http://172.17.0.2/, I can see this default page:
But where can I locate its location so that I can put my PHP projects in there?
This the DockerFile from that image:
FROM linuxconfig/apache
MAINTAINER Lubos Rendek <web@linuxconfig.org>
ENV DEBIAN_FRONTEND noninteractive
# Main package installation
RUN apt-get update
RUN apt-get -y install supervisor libapache2-mod-php5 php5-mysql mysql-server
# Extra package installation
RUN apt-get -y install php5-gd php-apc php5-mcrypt
# Configure MySQL
RUN sed -i 's/bind-address/#bind-address/' /etc/mysql/my.cnf
# Include supervisor configuration
ADD supervisor-lamp.conf /etc/supervisor/conf.d/
ADD supervisord.conf /etc/supervisor/
# Include PHP Info page
ADD index.php /var/www/html/index.php
# Create new MySQL admin user
RUN service mysql start; mysql -u root -e "CREATE USER 'admin'@'%' IDENTIFIED BY 'pass';";mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;";
# Allow ports
EXPOSE 80 3306
# Start supervisor
CMD ["supervisord"]
EDIT:
$ sudo docker run --name=lamp -dP -v $PWD/html:/var/www/html linuxconfig/lamp
c2d1687aef21f8a12a7fbb31bf8cf71c1e5adabf381bc6d70e8804c6663f0bc0
And:
$ sudo docker port lamp
80/tcp -> 0.0.0.0:32769
3306/tcp -> 0.0.0.0:32768
I go to my browser at: http://172.17.0.2:32769/
I get this error: