Lab 21:Installing docker in instance and build an image
- Get link
- X
- Other Apps
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
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
- Get link
- X
- Other Apps












Comments
Post a Comment