Docker LAMP 堆栈 - 保存 PHP 项目的位置在哪里?

Docker LAMP stack - where is the location to keep PHP projects?

我已经在 Docker 之前安装了 LAMP 堆栈。我正在使用此图像构建 运行 我的 Docker 的 LAMP 堆栈:

$ docker pull linuxconfig/lamp

全部下载安装完成后:

$ 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

所以在我的http://172.17.0.2/,我可以看到这个默认页面:

但是我在哪里可以找到它的位置以便我可以将我的 PHP 项目放在那里?

这是来自该图像的Docker文件:

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"]

编辑:

$ sudo docker run --name=lamp -dP -v $PWD/html:/var/www/html linuxconfig/lamp
c2d1687aef21f8a12a7fbb31bf8cf71c1e5adabf381bc6d70e8804c6663f0bc0

并且:

$ sudo docker port lamp
80/tcp -> 0.0.0.0:32769
3306/tcp -> 0.0.0.0:32768

我打开浏览器:http://172.17.0.2:32769/

我收到这个错误:

看看这篇文章是否有帮助:“LAMP ( Linux, Apache, MariaDB, PHP ) stack Docker image deployment

保存 index.php 文件并在新的 html 目录中。
或者,html 目录可能包含您想要的 PHP 应用程序:

$ mkdir html
$ vi html/index.php
$ ls html/
index.php

At this stage we are ready to deploy “linuxconfig/lamp” docker image:

sudo docker run --name=lamp -dP -v $PWD/html:/var/www/html linuxconfig/lamp

这意味着您正在将主机目录 html 装载到 linuxconfig/lamp 容器文件夹 /var/www/html 中。 (参见“Mount a host directory as a data volume”)