【问题标题】:Troubles with Dockerfile on Amazon Web Service BeanstalkAmazon Web Service Beanstalk 上的 Dockerfile 问题
【发布时间】:2016-01-04 16:15:23
【问题描述】:

我在 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版本不起作用...

我只有这个错误:

创建环境操作已完成,但命令超时。尝试增加超时时间。有关详细信息,请参阅故障排除文档。

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

【问题讨论】:

    标签: ubuntu amazon-web-services debian amazon-elastic-beanstalk dockerfile


    【解决方案1】:

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

    复制我之前的回答:https://stackoverflow.com/a/25558805/161628

    可以使用 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 的信息。有关选项设置的文档可在here 获得。

    【讨论】:

      猜你喜欢
      • 2011-08-13
      • 2014-08-20
      • 2013-03-05
      • 2015-04-10
      • 2018-02-27
      • 1970-01-01
      • 1970-01-01
      • 2012-06-19
      • 2016-11-15
      相关资源
      最近更新 更多