【发布时间】:2015-07-23 14:54:38
【问题描述】:
环境:
- Docker version 1.6.2, build ba1f6c3/1.6.2
- Centos 7
- apache httpd 2.4.6
我已经创建了 apache httpd 的 docker 镜像。里面有一个简单的 shell 脚本可以启动 httpd 服务器。 我的 start-httpd.sh
httpd -k start
#to keep process running
tail -f /dev/null
现在我复制到 docker 映像的配置与我在主主机上运行的配置相似。
负载均衡器配置示例:
<VirtualHost localhost:8000>
ServerName localhost
ProxyRequests off
ProxyPreserveHost on
ErrorLog logs/error_domain.log
SetHandler balancer-manager
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
Order allow,deny
Allow from all
</Location>
<Proxy balancer://idp>
BalancerMember http://punvm-core05.sigmasys.net:9091
BalancerMember http://punvm-core06.sigmasys.net:8091 status=+H
#ProxySet lbmethod=byrequests
ProxySet lbmethod=bytraffic
</Proxy>
ProxyPass /homepage balancer://idp
ProxyPassReverse /homepage balancer://idp
ProxyPass /assets balancer://idp/assets
ProxyPassReverse /assets balancer://idp/assets
ProxyPass /saml-idp balancer://idp/saml-idp
ProxyPassReverse /saml-idp balancer://idp/saml-idp
</VirtualHost>
现在这就是我运行 docker 映像的方式,
docker run -d -p 10000:8000 auth/loadbalancer /home/start-httpd.sh
我可以访问http://localhost:10000,但我期望的页面不同
附加预期和意外 httpd 服务器页面的快照
预期图像,这是来自我的主机:
如上述 docker 命令中所述,访问映射到 docker 内部端口的 apache 时出现意外图像
此外,当我登录到容器并执行 curl 命令时,作为响应,我可以看到负载均衡器页面,但从容器外部我看到了意外图像的响应。
请说明为什么会这样,我错过了什么。
【问题讨论】:
-
谢谢...我从你的问题中发现我应该添加一个“tail -f /dev/null”:) 出于某种原因,apache repo 的 Dockerfile 中的 -DFOREGROUND 选项不会为我工作。
-
是的,这就是我保持容器运行的方式.. :)
标签: apache docker httpd.conf