Installing Super Mario Game in a Docker Container on AWS EC2 | AWS Tutorial | Devops
In this session, we will be deploying a Super Mario game in a Docker container with AWS EC2 instance.
I will be using an image which I found from Docker Hub.
Thanks to the one who created and updated the Docker image (kaminskypavel/mario) on Docker Hub
Please be aware that the services involved in the task may incur charges.
To begin we need an EC2 instance. I have already created one and here it is. (Ubuntu 22.04)
Let us access to the server and show some magic.
ssh -i "keypair.pem" "user"@"public_ip"
Don’t hesitate to update the packages
apt update
Moving further, we are going to install the docker. Installing docker seems to be the longest process in the task were creating container is just two commands. Execute the commands in the order(Not explaining the installation of Docker)
apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg
- dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg - print-architecture)
signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
apt-cache policy docker-ce
apt install docker-ce -y
systemctl status docker
Yes guys! We did it. Docker installation is now completed.
If the docker is installed, then the rest is just a cake walk.🍰
Now we need an image for our container. We will be using “kaminskypavel/mario” from Docker Hub.
Pull the image
docker pull kaminskypavel/mario
Verify that the image is available
docker images
Now we need to run a container with the image. We will be using the 80 port of the server to access our application in the container.
docker run -it -p 80:8080 kaminskypavel/mario
The container is running now. Let us try to access it from a browser.
Copy the public ip and try.
Huuurrrraaaayyyyyyyy!🥳
Our game is working fine and the excitement to play Super Mario is the same as earlier.(Still I am not able to cross the 4th level😒)
If you have any doubts in between please comment below.