我的构建不包括我的网站指令
My build does not include my web site directive
我不确定 rails 我从哪里出发,但我正在尝试为我的网站创建一个容器。首先,我从一个名为 'default':
的文件开始
server {
root /var/www;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
var/www/
指向我的 Web 内容,index.html
是内容的默认文件。
然后我创建非常简单的 Docker 文件:
FROM httpd
MAINTAINER Jay Blanchard
RUN httpd
ADD default /home/OARS/
在我的 Docker 文件中,我引用了上面的默认文件,认为这是指向我的 Web 内容所需要的。默认文件恰好与 Docker 文件位于同一目录中,但我给出了路径 /home/OARS/
正如我在一些示例中看到的那样。
构建成功:
foo@bar:/home/OARS$ sudo docker build -t oars-example .
Sending build context to Docker daemon 3.072 kB
Sending build context to Docker daemon
Step 0 : FROM httpd
---> cba1e4bb4caa
Step 1 : MAINTAINER Jay Blanchard
---> Using cache
---> e77807e98c6b
Step 2 : RUN httpd
---> Using cache
---> c0bff2fb1f9b
Step 3 : ADD default /home/OARS/
---> 3b4053fbc8d4
Removing intermediate container e02d27c4309d
Successfully built 3b4053fbc8d4
并且 运行 似乎是成功的:
foo@bar:/home/OARS$ sudo docker run -d -P oars-example
9598c176a706b19dd28dfab8de94e9c630e5781aca6930564d15182d21b0f6a5
9598c176a706 oars-example:latest "httpd-foreground" 6 seconds ago Up 5 seconds 0.0.0.0:32776->80/tcp jovial_fermat
然而,当我转到 IP(使用端口 32776,端口 80 上已经有一些东西 运行ning)时,我没有得到我在 /var/www
中指定的索引页面,但是我确实从 Apache 服务器获取默认索引页。
这是来自服务器的日志:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 000.000.000.000. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 000.000.000.000. Set the 'ServerName' directive globally to suppress this message
[Tue May 19 16:59:17.457525 2015] [mpm_event:notice] [pid 1:tid 140053777708928] AH00489: Apache/2.4.12 (Unix) configured -- resuming normal operations
[Tue May 19 16:59:17.457649 2015] [core:notice] [pid 1:tid 140053777708928] AH00094: Command line: 'httpd -D FOREGROUND'
000.000.000.000 - - [19/May/2015:17:00:08 +0000] "GET / HTTP/1.1" 200 45
000.000.000.000 - - [19/May/2015:17:00:08 +0000] "GET /favicon.ico HTTP/1.1" 404 209
I've changed the IP addresses in the logs just to keep things kosher.
我是否遗漏了一些明显的东西来确保我的网站文件 运行 在容器中?
首先,您尝试在 Apache 容器中使用 nginx 配置文件。
那么,根据the base container documentation,正确的配置文件指定方式是:
# Dockerfile
FROM httpd
COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf
我不确定 rails 我从哪里出发,但我正在尝试为我的网站创建一个容器。首先,我从一个名为 'default':
的文件开始server {
root /var/www;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
var/www/
指向我的 Web 内容,index.html
是内容的默认文件。
然后我创建非常简单的 Docker 文件:
FROM httpd
MAINTAINER Jay Blanchard
RUN httpd
ADD default /home/OARS/
在我的 Docker 文件中,我引用了上面的默认文件,认为这是指向我的 Web 内容所需要的。默认文件恰好与 Docker 文件位于同一目录中,但我给出了路径 /home/OARS/
正如我在一些示例中看到的那样。
构建成功:
foo@bar:/home/OARS$ sudo docker build -t oars-example .
Sending build context to Docker daemon 3.072 kB
Sending build context to Docker daemon
Step 0 : FROM httpd
---> cba1e4bb4caa
Step 1 : MAINTAINER Jay Blanchard
---> Using cache
---> e77807e98c6b
Step 2 : RUN httpd
---> Using cache
---> c0bff2fb1f9b
Step 3 : ADD default /home/OARS/
---> 3b4053fbc8d4
Removing intermediate container e02d27c4309d
Successfully built 3b4053fbc8d4
并且 运行 似乎是成功的:
foo@bar:/home/OARS$ sudo docker run -d -P oars-example
9598c176a706b19dd28dfab8de94e9c630e5781aca6930564d15182d21b0f6a5
9598c176a706 oars-example:latest "httpd-foreground" 6 seconds ago Up 5 seconds 0.0.0.0:32776->80/tcp jovial_fermat
然而,当我转到 IP(使用端口 32776,端口 80 上已经有一些东西 运行ning)时,我没有得到我在 /var/www
中指定的索引页面,但是我确实从 Apache 服务器获取默认索引页。
这是来自服务器的日志:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 000.000.000.000. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 000.000.000.000. Set the 'ServerName' directive globally to suppress this message
[Tue May 19 16:59:17.457525 2015] [mpm_event:notice] [pid 1:tid 140053777708928] AH00489: Apache/2.4.12 (Unix) configured -- resuming normal operations
[Tue May 19 16:59:17.457649 2015] [core:notice] [pid 1:tid 140053777708928] AH00094: Command line: 'httpd -D FOREGROUND'
000.000.000.000 - - [19/May/2015:17:00:08 +0000] "GET / HTTP/1.1" 200 45
000.000.000.000 - - [19/May/2015:17:00:08 +0000] "GET /favicon.ico HTTP/1.1" 404 209
I've changed the IP addresses in the logs just to keep things kosher.
我是否遗漏了一些明显的东西来确保我的网站文件 运行 在容器中?
首先,您尝试在 Apache 容器中使用 nginx 配置文件。
那么,根据the base container documentation,正确的配置文件指定方式是:
# Dockerfile
FROM httpd
COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf