Amazon Web Service Beanstalk 上的 Dockerfile 问题

Troubles with Dockerfile on Amazon Web Service Beanstalk

我在 Amazon Web Service (BeanStalk) 上启动了两个带有 2 个 Dockerfile 的环境(一个带有 Ubuntu,一个带有 Debian)

DOCKERFILE UBUNTU :

FROM ubuntu:12.04

RUN apt-get update
RUN apt-get install -y emacs apt-utils
RUN apt-get install -y php5 php5-cli ldap-utils apache2 libapache2-mod-php5 php5-mysql
                       php-pear php5-dev php5-gd php5-mcrypt
RUN apt-get install -y libapache2-mod-auth-mysql
RUN apt-get install -y curl libcurl3 libcurl3-dev php5-curl
RUN apt-get install -y zziplib-bin
RUN apt-get install -y openssl

RUN a2enmod php5
RUN a2enmod rewrite

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

CMD /usr/sbin/apache2ctl -D FOREGROUND

DOCKERFILE DEBIAN :

FROM debian

RUN apt-get update
RUN apt-get install -y emacs apt-utils
RUN apt-get install -y php5 php5-cli ldap-utils apache2 libapache2-mod-php5 php5-mysql
                       php-pear php5-dev php5-gd php5-mcrypt
RUN apt-get install -y libapache2-mod-auth-mysql
RUN apt-get install -y curl libcurl3 libcurl3-dev php5-curl
RUN apt-get install -y zziplib-bin
RUN apt-get install -y openssl

RUN a2enmod php5
RUN a2enmod rewrite

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

CMD /usr/sbin/apache2ctl -D FOREGROUND

我不明白为什么 debian 版本不起作用...

我只有这个错误:

Create environment operation is complete, but with command timeouts. Try increasing the timeout period. For more information, see troubleshooting documentation.

你能帮帮我吗?有什么想法吗?

这是因为下载和构建 docker 图像所花费的时间是可变的。您可以使用选项设置增加超时。

从这里复制我之前的回答:

可以使用 ebextensions 指定选项设置。

在您的应用程序源中创建一个名为 .ebextensions 的目录中的文件。假设文件是​​ .ebextensions/01-increase-timeout.config.

文件内容应为:

option_settings:
    - namespace: aws:elasticbeanstalk:command
      option_name: Timeout
      value: 1000

请注意此文件为 YAML 格式。 在此之后,您可以使用此版本的源代码更新您的环境。

来自此选项设置的文档:

Timeout: Number of seconds to wait for an instance to complete executing commands.

For example, if source code deployment tasks are still running when you reach the configured timeout period, AWS Elastic Beanstalk displays the following error: "Some instances have not responded to commands. Responses were not received from <instance id>." You can increase the amount of time that the AWS Elastic Beanstalk service waits for your source code to successfully deploy to the instance.

您可以阅读有关 ebextensions 的更多信息 here. Documentation on option settings is available here