Docker LAMP stack-存放PHP项目的位置在哪里?

Docker LAMP stack-存放PHP项目的位置在哪里?,php,apache,docker,dockerfile,lamp,Php,Apache,Docker,Dockerfile,Lamp,我已经在Docker之前安装了灯组。我正在使用此图像构建并运行Docker的灯堆栈: $ docker pull linuxconfig/lamp 下载并安装完所有组件后: $ docker run -it linuxconfig/lamp /bin/bash root@2e80dfd55a6e:/# service apache2 start [....] Starting web server: apache2AH00558: apache2: Could not reliably det

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

$ 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
因此,在我的主页上,我可以看到这个默认页面:

但是我在哪里可以找到它的位置,这样我就可以把我的PHP项目放在那里

这是来自该图像的DockerFile:

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"]
以及:

我在以下位置进入浏览器:

我得到这个错误:


看看这篇文章是否有帮助:“

index.php
文件保存到新的
html
目录中。
或者,
html
目录可能包含所需的PHP应用程序:

$ mkdir html
$ vi html/index.php
$ ls html/
index.php
在此阶段,我们准备部署“
linuxconfig/lamp
”docker镜像:


这意味着您正在将主机目录
html
装入
linuxconfig/lamp
容器文件夹
/var/www/html
。(请参阅“”)

谢谢您的回答。我现在收到一个错误,
无法访问此站点172.17.0.2拒绝连接。
。请看我的编辑上面。谢谢。@teelou你的操作系统是什么?窗户?Linux?雨衣?你用的是哪个码头工人?基于VirtualBox的工具箱?还是HyperV(WindowsX的Docker)?还是基于XHyve虚拟机?(Docker for Mac)我在Linux Xubuntu 16.04上。@teelou您可能不得不忽略172.17.0.2 ip:这似乎是一条通用消息,也可以在中看到。localhost应该足够了。@teelou如图所示,172.17.0.2必须是容器的IP(当它从所述容器开始时是Apache报告),但在主机上,只能使用localhost。
$ sudo docker port lamp
80/tcp -> 0.0.0.0:32769
3306/tcp -> 0.0.0.0:32768
$ mkdir html
$ vi html/index.php
$ ls html/
index.php
sudo docker run --name=lamp -dP -v $PWD/html:/var/www/html linuxconfig/lamp