AWS Logo
Menu
Deploying a Docker-Based Application on AWS Elastic Beanstalk

Deploying a Docker-Based Application on AWS Elastic Beanstalk

I deployed a Dockerized version of the 2048 game on AWS Elastic Beanstalk. This document outlines the complete setup from building the Docker image to hosting it using Elastic Beanstalk.

Published Jun 4, 2025
Prepare the Dockerfile
FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install -y nginx zip curl
RUN echo “daemon off;” >> /etc/nginx/nginx.conf RUN curl -o /var/www/html/master.zip -L https://github.com/gabrielecirulli/2048/archive/refs/heads/master.zip
RUN cd /var/www/html && unzip master.zip && mv 2048-master/* . && rm -rf 2048-master master.zip
EXPOSE 80
CMD [“/usr/sbin/nginx”, “-c”, “/etc/nginx/nginx.conf”]
# This Dockerfile sets up a simple Nginx server to host the 2048 game.
For testing locally,
docker build -t 2048_game .
docker images
docker run -d -p 80:80 image-id
docker ps
on AWS Elastic beanstalk
  1. Log in to the AWS Console
  2. Go to Elastic Beanstalk
  3. Click Create environment
  4. Choose a Web server environment
  5. Select Docker platform
  6. Upload your code or connect to GitHub
  7. Click Create environment App name (e.g. 2048-game-eb)
  8. Platform → select Docker Region (e.g. us-east-1)
  9. create app
  10. Go to Environment
IAM Role Created: An IAM role named aws-elasticbeanstalk-service-role (Elastic Beanstalk — Environment) was created and assigned to allow Elastic Beanstalk to manage AWS resources like S3, EC2, and CloudWatch on behalf of the application environment
Created Elastic Beanstalk Environment
IAM role
Environment
Dockerfile
Testing of game

 

Comments