I am attempting to host a Docker application with AWS via Elastic Beanstalk. When going through manual creation of an environment I am given the option to run a sample application in the environment, upload my own, or pull an application off of s3. By uploading a Dockerrun.aws.json
file with all the necessary configuration the environment is able to pull and run my Docker image.
Now I am using Terraform to programmatically create and configure these environments. However, upon creation they all run the sample application, which in turn causes problems when I attempt to manually upload the Dockerrun file to the environment.
What is the proper way to include the Dockerrun information in the Terraform configuration so my application can deploy without a hitch?
A Dockerrun. aws. json file is an Elastic Beanstalk–specific JSON file that describes how to deploy a set of Docker containers as an Elastic Beanstalk application. You can use a Dockerrun.
AWS Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, . NET, PHP, Node. js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.
Docker lets you build, test, and deploy applications quickly Using Docker, you can quickly deploy and scale applications into any environment and know your code will run. Running Docker on AWS provides developers and admins a highly reliable, low-cost way to build, ship, and run distributed applications at any scale.
You should use an S3 bucket to store the Dockerrun.aws.json
and set up a Beanstalk application version.
Something like:
resource "aws_elastic_beanstalk_application_version" "latest" {
name = "latest"
application = "your_app"
bucket = "your_bucket"
key = "Dockerrun.aws.json"
}
Then add to your Beanstalk environment:
version_label = "${aws_elastic_beanstalk_application_version.latest.name}"
Of course, is better to use references instead of hardcoding names.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With