Docker网站在一段时间后打开 - EC2 / VirtualBox


docker website opens after a while - ec2/virtualbox

我已经创建了一个docker镜像,并在本地进行了测试。一切运作良好。

之后,我使用了相同的 Dockerfile - 构建了它并在 EC2 上运行它。

Apache网络服务器正在侦听连接,我已经在EC2机器安全设置中打开了防火墙,但是如果我尝试导航到webisite,它似乎打开了大约2.5分钟。

然后是网站OPENS。每个导航步骤需要 2.5 分钟。

后:

我尝试使用Virtual Box在Windows机器上复制此环境,并且存在完全相同的问题。网站需要很长时间才能最终打开。它还断开了与另一台完全与docker无关的机器的连接(Ubuntu开发盒)

任何人都可以建议什么吗?

这是码头工人文件:

FROM ubuntu
RUN apt-get update -y
RUN apt-get install -y apache2 php5 vim libapache2-mod-php5 php5-mcrypt 
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
EXPOSE 80
RUN ln -sf /dev/stderr /var/log/apache2/error.log
CMD /usr/sbin/apache2ctl -D FOREGROUND

如"Debug your PHP in Docker with Intellij/PHPStorm and Xdebug"所示,可以从容器内调试 php。

OP直接在php.ini中激活了它:

[xdebug]
  zend_extension="/usr/lib/php5/20121212/xdebug.so" 
  xdebug.remote_enable=on xdebug.remote_handler=dbgg
  xdebug.remote_host=172.17.0.1
  xdebug.remote_port=9000
  xdebug.remote_connect_back=on
  xdebug.remote_autostart=on
  xdebug.remote_log="/var/log/xdebug/xdebug.log" 

删除该模块足以缩短响应时间。