Content

                                                  Content How to create an AWS free Account? Lab 1: To launch amazon Linux EC2 instance Lab 2: To Connect to the instance from Linux client Operating System Lab 3:To Launch amazon windows instance Lab 4: Installing apache in EC2 instance Lab 5: Installing Nginx in EC2 instance Lab 6: Changing Host Name Lab 7: Creating a user and making as a sudoer Lab 8:Assigning an Elastic ip Lab 9:Creating ebs,attach and detach the volumn to the instance Lab 10:Creating an S3 Bucket and creating cross replication in another region Lab 11:Load Balancer Lab 12:Two instances with Application Load Balancer Lab 13:Launching two instances with load Balancer Lab:14 Creating Own VPC  Lab 15: Two instances which classic load Balance with own VPC Lab 16:Two instances with Application load Balancer with own VPC Lab 17: Relational Data B...

Lab 21:Installing docker in instance and build an image

                                               Installing docker in instance and build an image



What is docker?

Docker is containerization platform that packages your application and all its dependencies together in the form of containers to ensure that your applications works seamlessly any environment.

Why we use-----------> to building fast development fast,migration fast ,most important is cost and resources utilization is more

Where------------- > where all kinds of apps you can move

How to-------------> do install the docker engine(yum or apt-get by enabling EPEI)

Some keywords:

Image

1   Containers

3.     Docker file

4.     Docker compose

5.     Docker swarm

6.     Docker repo

7.     Docker hub

8.     Docker engine

Image:image Is an immutable application,you cant login to image until you can built from the docker file.

Once you run the image it becomes a container

When you build a docker it will always look like a docker file

How docker works?

                        Scratch

                              |

                      Application

                               |

                           Image

                               |

                        Docker engine

                               |

                          Kernel

Installing the docker

Docker --------->enable EPEL

#yum install docker- y

Start the docker engine

System ctl start docker

Service docker start

To check docker running or not

Docker images

To see containers

Dockerps

To run the image

docker run –itd<imagename>

Or

docker  run –d<image name>

To map the port mapping

docker run –d –p hostport:containerport<name>

To stop docker container

docker stop<containerid>

To login to container

docker exec –it<containerid>bash

 

Lab :Installing the docker engine in an EC2 instance

Step 1: Create an instance

Refer above how to launch an instance

Then login to the instance

#ssh –i<pemfile>ec2-user@ipaddress

Switch to root user:sudo su

Then install docker engine

#yum install docker

First go to the bash

Login to the instance

 


Now switch to root user

#sudo su

And the install docker engine

#yum install docker

 


Now start the docker engine

Service docker start (or) systemctl start docker

 

Now check whether docker is running or not

#ps-ef | grep-i docker

 


To check the images

Docker images

 


As for now don’t have any image

Let’s create an image

#docker pull<image>

For this lab an installing httpd in the docker container

#docker pull httpd

 

Image downloads

Let’s check the images

#docker images

 

Have an image

Now run the image

#docker run –d<imagename>

#docker run –d httpd

 

Now check docker container

#dockerrps 



Image is in the container

Now map the port number with container

Because httpd is installed inside container.If we want to see apache page we should map the port number with container port.

To map the port number.

#docker run –d –p 80:80 httpd

 


Now run the page in the browser by giving instance IP address

 


Have the page.

We installed the docker container and inside the container we installed the apache.

Execrise: Build an image nodejs.

Build an image of react js

Build an image of angular js

Build an image of nginx

                       

Comments

Popular posts from this blog

Lab 22:Pushing a docker image to docker hub

Lab 5: Installing Nginx in EC2 instance