`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년 전300회 조회
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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠