drgawfsf1069 2015-02-13 22:40
浏览 39

无法在生产主机上使用docker运行php站点

I only have this issue on a Digital Ocean box. On my laptop I can see the website. On production I get 500 when trying to curl my site. if i hit the gateway of that docker from the outside world, i can see my site. but that's not a solution. i would like to point my dns to the ip of the host and not the docker gateway.

dockerfile

FROM phusion/baseimage:0.9.15

ENV HOME /root

RUN /etc/my_init.d/00_regen_ssh_host_keys.sh

CMD ["/sbin/my_init"]

# Nginx-PHP Installation
RUN apt-get update
RUN apt-get install -y vim curl wget build-essential python-software-properties
RUN add-apt-repository -y ppa:ondrej/php5
RUN add-apt-repository -y ppa:nginx/stable
RUN apt-get update
RUN apt-get install -y --force-yes php5-cli php5-fpm php5-mysql php5-pgsql php5-sqlite php5-curl\
                       php5-gd php5-mcrypt php5-intl php5-imap php5-tidy

RUN sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php5/fpm/php.ini
RUN sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php5/cli/php.ini

RUN apt-get install -y nginx

RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php5/fpm/php-fpm.conf
RUN sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php5/fpm/php.ini

RUN mkdir -p        /var/www
ADD build/default   /etc/nginx/sites-available/default
RUN mkdir           /etc/service/nginx
ADD build/nginx.sh  /etc/service/nginx/run
RUN chmod +x        /etc/service/nginx/run
RUN mkdir           /etc/service/phpfpm
ADD build/phpfpm.sh /etc/service/phpfpm/run
RUN chmod +x        /etc/service/phpfpm/run

EXPOSE 80
# End Nginx-PHP

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

build and run

docker build -t donate-home .
docker run --name donate-home -d -p 3001:80 -v $(pwd)/www:/var/www:rw donate-home /sbin/my_init --enable-insecure-key

on production host

curl -i localhost:3001

HTTP/1.1 500 Internal Server Error

docker logs donate-home

*** Installing insecure SSH key for user root                                                                                                                                          │····························
Creating directory /root/.ssh...                                                                                                                                                       │····························
Editing /root/.ssh/authorized_keys...                                                                                                                                                  │····························
Success: insecure key has been added to /root/.ssh/authorized_keys                                                                                                                     │····························
                                                                                                                                                                                       │····························
+------------------------------------------------------------------------------+                                                                                                       │····························
| Insecure SSH key installed                                                   |                                                                                                       │····························
|                                                                              |                                                                                                       │····························
| DO NOT expose port 22 on the Internet unless you know what you are doing!    |                                                                                                       │····························
|                                                                              |                                                                                                       │····························
| Use the private key below to connect with user root                         |                                                                                                        │····························
+------------------------------------------------------------------------------+                                                                                                       │····························
                                                                                                                                                                                       │····························
-----BEGIN RSA PRIVATE KEY-----                                                                                                                                                        │····························
<content of private key>
-----END RSA PRIVATE KEY-----                                                                                                                                                          │····························
                                                                                                                                                                                       │····························
                                                                                                                                                                                       │····························
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...                                                                                                                                │····························
*** Running /etc/rc.local...                                                                                                                                                           │····························
*** Booting runit daemon...                                                                                                                                                            │····························
*** Runit started as PID 17                                                                                                                                                            │····························
[13-Feb-2015 22:13:12] NOTICE: fpm is running, pid 31                                                                                                                                  │····························
[13-Feb-2015 22:13:12] NOTICE: ready to handle connections
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 BP神经网络控制倒立摆
    • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
    • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
    • ¥30 Unity接入微信SDK 无法开启摄像头
    • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
    • ¥20 cad图纸,chx-3六轴码垛机器人
    • ¥15 移动摄像头专网需要解vlan
    • ¥20 access多表提取相同字段数据并合并
    • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
    • ¥20 Java-Oj-桌布的计算