Run Docker On AWS For Free!!!!!

Abhiman Gowda
4 min readJul 7, 2021

What are Dockers?

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure. Docker provides the ability to package and run an application in a loosely isolated environment called a container. The isolation and security allow you to run many containers simultaneously on a given host. Containers are lightweight and contain everything needed to run the application, so you do not need to rely on what is currently installed on the host. You can easily share containers while you work, and be sure that everyone you share with gets the same container that works in the same way.

Running Docker on the cloud!!

There are many cloud services that provide this service like AWS [Amazon Web service], Linode, Google cloud, etc.

[here I’m showing it in amazon cloud service].

Requirements:

  1. create an AWS account.
  2. download Putty from ->https://www.putty.org/

Step1: sign in to AWS management console. click on services.

img: 1
img:2

step2:select EC2 under compute and click Launch Instance.

step3:select the free virtual Machine image according to your computer spec.

img:3 selecting the virual os image.
img:4 selecting instance type
img:5 Adding Rule

step4:select the free tier.if you are working on an industrial project and need more storage space and rem then you are free to select the paid offers as per your needs. click review and Launch

step 5:click on add rules just set port range 80.and click review and launch.

img:6 Downloading key pair

Step 6:select create new key pair. and Download key pair.[Remember this is the only chance to download the key ]this key will help to connect our machine with AWS virtual machine.]then click Launch Instances.

img:7

step 7:open putty gen->click on conversions ->import key

img:8 converting .pem key to .ppk key

step 8:click on Generate save the key by giving any name the key will be converted into .ppk don't change it.

img :9 accessing VM

Step 9:open putty configuration.

select shh ->auth on category window. brows the key which was generated by putty key generator[ie .ppk key].and click open.

img:10 loging in

Step 10: a window pops open just type ubuntu as we have selected ubuntu machine at the begining.

Run the below command after logging in

[Copy the whole command below at once and paste in the poped window]

Step 11:Installing updates and pre-requisites.

sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Installing Docker on AWS virtual machine.

[copy line by line and click enter to install [dont worry about any errors.]
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-get install docker-ce docker-ce-cli containerd.io
apt-cache madison docker-ce
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo apt install docker.io
sudo apt install docker-compose

[After installing all the requisites]

Step12:just type docker — version to check wheather docker is installed .or just type docker ps this must show empty results below container id image command etc..

img:11 Downloading and installing

Step 13:Lets download web server by docker run -d -p 80:80 — name server nginx

img:12 checking whether the docker is running on specified port.

Step 14:After running the above command if you run docker ps then you must get the result somewhat like img 12

img:13 output

now if you navigate to the public IP of the vm[virtual machine] then you must get nginx page as in img 13. [public IP can be found on instances page as you can see in image 9

img:14

I have created a simple HTML page and linked it with the Nginx server to show the demo in img 14.

DECLARATION: THIS CONTENT IS WRITTEN AS PER MY KNOWLEDGE FEEL FREE TO COMMENT HOPE THIS CONTENT IS USEFULL.

--

--