Menu
AWS Elastic Beanstalk
Developer Guide (API Version 2010-12-01)

Single Container Docker Environments

Single container Docker environments can be launched from a Dockerfile (which describes an image to build), a Dockerrun.aws.json file (which specifies an image to use and additional Elastic Beanstalk configuration options), or both. These configuration files can be bundled with source code and deployed in a ZIP file.

Get started with one of the following example applications, or see Single Container Docker Configuration for details on authoring Docker configuration files for a single container environment.

To run a sample application using the AWS Management Console

  1. Download a source bundle from the linked GitHub page by clicking Download ZIP on the right side of the screen.

  2. Follow the instructions in Launching an Environment with a Sample Application.

To run a sample application using the EB CLI

  1. Clone the GitHub repository or save the Dockerfile in a local project folder.

  2. Run eb init in the project folder to configure the repository for use with the EB CLI.

  3. Run eb create to create an environment and deploy the sample.

For detailed instructions on configuring and using the EB CLI, see Configure the EB CLI and Managing Elastic Beanstalk Environments with the EB CLI.

Sample PHP Application

GitHub link: awslabs/eb-demo-php-simple-app

This sample is a PHP application that runs on a custom Ubuntu image defined in a Dockerfile.

The PHP sample application uses Amazon RDS. You may be charged for using these services. If you are a new customer, you can make use of the AWS Free Usage Tier. For more information about pricing, see the following:

Sample Python Application

GitHub link: awslabs/eb-py-flask-signup

This sample is a Python application that runs on a custom Ubuntu image defined in a Dockerfile. It also includes a Dockerrun.aws.json file that maps a storage volume on the container to a matching path on the host instance.

The Python sample application uses Amazon DynamoDB, Amazon SQS, and Amazon SNS. You may be charged for using these services. If you are a new customer, you can make use of the AWS Free Usage Tier. For more information about pricing, see the following:

Sample Dockerfile Application

This sample is a Dockerfile configured to download the game 2048 from GitHub and run it on nginx.

Copy and paste the example into a file named Dockerfile and upload it instead of a source bundle when creating the environment.

FROM ubuntu:12.04

RUN apt-get update
RUN apt-get install -y nginx zip curl

RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN curl -o /usr/share/nginx/www/master.zip -L https://codeload.github.com/gabrielecirulli/2048/zip/master
RUN cd /usr/share/nginx/www/ && unzip master.zip && mv 2048-master/* . && rm -rf 2048-master master.zip

EXPOSE 80

CMD ["/usr/sbin/nginx", "-c", "/etc/nginx/nginx.conf"]