`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?

demandé il y a 2 ans293 vues
1 réponse
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
répondu il y a 8 mois
AWS
INGÉNIEUR EN ASSISTANCE TECHNIQUE
vérifié il y a 8 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions