To launch Docker in Ec2 Instance and installing Webserver on Docker

To launch Docker in Ec2 Instance and installing Webserver on Docker


To Launch An Instance in AWS ::

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic.

No alt text provided for this image

▪ give name to your instance

▪ select ISO image to launch OS

▪ select the architecture

▪ select instance type

▪ Download the key pair

▪Do network settings

▪Do network settings

▪ configure storage

▪ select no.of instances to launch

▪ If you want read the summary for review

Then click on LAUNCH INSTANCE

To connect to the launched instance using SSH

First we need to give permission using chmod command

$ chmod 400 redhat-key.pem

Then using ssh connect to the instance

$ ssh -i "key_name" <user_name>@ <public_ip>

No alt text provided for this image

To Install Docker In EC-2 Instance

Docker makes development efficient and predictable,Docker takes away repetitive, mundane configuration tasks and is used throughout the development lifecycle for fast, easy and portable application development.

$ apt-get install docker.io

Docker needs root permission ,we can't directly run docker by using normal user privilages

No alt text provided for this image

Before going to install docker,first you need to update the instance by running the command

$ apt-get update

Then run again the command to install the docker,then docker will be installed in your instance,To check use the command $ docker images

To launch a container using Docker

$ docker run -it <image_name>:<tag>(optional)

We can use run cmd or pull cmd to download os image in docker

No alt text provided for this image


When we run the command . it by default after installing the image it uses that image and we enter into that container

Here we need to use -p option for port forwarding

To install Web Server in Container

$ apt install apache2

Run the above command To install web server in ubuntu.

To View From Web Browser

Enter the public ip of the instance you launched in AWS in the browser to see the web page you have written.

No alt text provided for this image
Thanks For Reading :)

To view or add a comment, sign in

More articles by Anudeepthi Kolagani

  • To launch a redhat ec2 instance in AWS To launch webserver

    To Launch An Instance in AWS :: Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the…

  • LAMBDA Function In AWS

    ▪ AWS Lambda is a serverless compute service that runs your code in response to events ▪ These events may include…

    2 Comments
  • Quantum Computing

    Quantum Computer: ✳ Quantum Computer had the potential to simulate things a classical computer could not feasibly do ✳…

    6 Comments
  • Templates concept in PYTHON

    What is Template ? Template is a class of String module. It allows for data to change without having to edit the…

  • How To Read The Data From "RAM"

    What is RAM ? Random-access memory (RAM) is a computer’s short-term memory. RAM is short for “random access memory” and…

  • FUNNY COMMANDS IN LINUX

    ➡️ cowsay : - An ASCII cow in the terminal will say whatever you want. The cowsay command draws out little animals…

  • DATE COMMAND

    date - print or set the system date and time SYNOPSIS : - date [OPTION]..

  • espeak-ng

    espeak-ng : - A multi-lingual software speech synthesizer SYNOPSIS : - espeak-ng [options] [words] DESCRIPTION : -…

  • ZENITY

    NAME : - zenity - display GTK+ dialogs SYNOPSIS : - zenity [options] DESCRIPTION : - zenity is a program that will…

Others also viewed

Explore content categories