`docker build` timeout on AWS Elastic Beanstalk

0
  • Service: Elastic Beanstalk
  • Platfrom: Docker running on 64bit Amazon Linux 2
  • Platfrom Version: 3.4.17

My Docker builds take around 30 minutes, and I have no way to increase the timeout of Elastic Beanstalk deployments.

  1. I've tried to add a config to .ebextensions, but it doesn't work.
// timeout.config
option_settings:
    - namespace: aws:elasticbeanstalk:command
      option_name: Timeout
      value: 3600
  1. and I also try to deploy from CLI, it also does not work.
eb create app-env --timeout 60

I always get the same error message from /var/log/eb-engine.log

 [ERROR] An error occurred during execution of command [app-deploy] - [Docker Specific Build Application]. Stop running the command. Error: failed to build docker image: Command /bin/sh -c docker build -t aws_beanstalk/staging-app /var/app/staging/ failed with error Command timed out after 300 seconds 

Is it possible to increase this timeout?

已提问 2 年前296 查看次数
1 回答
0

Hi, thank you for reaching out!

It seems you are running into a timeout issue on Docker while using Elastic Beanstalk.

Probable causes:

1- Elastic Beanstalk namespace aws:elasticbeanstalk:command has a default Timeout of 600 seconds (840s to be exact as EB add 240s by default, and it go go up to 3600s per AWS Documention here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#command-options-general-elasticbeanstalkcommand I have noticed you increased the timeout to 3600s which did not solve your issue even though the error message “failed with error Command timed out after 300 seconds” from your /var/log/eb-engine.log suggests the timeout is the issue when you tried to deploy your app from the CLI. So, your issue is elsewhere and this leads us to the next point.

2- Your Docker build taking 30 minutes seems too long and it can be optimized: a. If your build still isn’t working I would recommend trying out your docker build on a EC2 instance or try to multi-stage builds. You can learn more here: https://docs.docker.com/build/guide/multi-stage/ b. Elastic Beanstalk variables aren't accessible by the other containers in the Dockerfile that are getting built in earlier stages, you can follow the steps in the resolution to set dynamic environment variables during the build stage. Here is a step-by-step guide on how you can accomplish that: https://www.repost.aws/knowledge-center/elastic-beanstalk-env-variables-docker

If you have more questions or require further assistance please feel free to reach out to us! Have a great day.

Articles For Consideration:‘ https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker.html https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/docker-multicontainer-migration.html https://docs.docker.com/build/guide/layers/

AWS
jared_v
已回答 8 个月前
AWS
支持工程师
已审核 8 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则