Professional Documents
Culture Documents
Anantgarg_500084917_R2142201709+lab+file-1-29
Anantgarg_500084917_R2142201709+lab+file-1-29
DEHRADUN
“CONTAINER ORCHESTRATION
&
INFRASTRUCTURE AUTOMATION”
LAB FILE
Submitted to
MR. ABHIRUP KHANNA
ASSISTANT PROFESSOR
SCHOOL OF COMPUTER SCIENCE
By:
ANANT GARG
500084917
R2142201709
B3-CCVT NON-HONS
1|Page
Lab Experiment: 1................................................................................................................................... 3
“Installing Docker on Linux” ................................................................................................................ 3
Lab Experiment: 2................................................................................................................................... 5
“Installing Docker in windows” ........................................................................................................... 5
Lab Experiment: 3................................................................................................................................... 9
“Working with Docker: Images” ......................................................................................................... 9
Lab Experiment: 4 ................................................................................................................................ 11
“Working with Docker File” ............................................................................................................... 11
Lab Experiment: 5................................................................................................................................. 15
“Docker Public Repository” ............................................................................................................... 15
Lab Experiment: 6................................................................................................................................. 18
“Managing Ports in Docker” ............................................................................................................. 18
Lab Experiment: 7................................................................................................................................. 21
“Docker private registry” .................................................................................................................. 21
Lab Experiment: 8................................................................................................................................. 23
Docker-Building a Web Server Docker File ........................................................................................ 23
Lab Experiment: 9................................................................................................................................. 25
“Docker: Container linking” .............................................................................................................. 25
Lab Experiment: 10............................................................................................................................... 27
“Installing & Starting in this MiniKube” ............................................................................................ 27
2|Page
Lab Experiment: 1
“Installing Docker on Linux”
3|Page
Fig 1.3(Docker status active)
4|Page
Lab Experiment: 2
“Installing Docker in windows”
Step1: -Download Docker Installer Using this link
https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe
5|Page
Step 3: - Once you click ok. The Unpacking of Files starts
6|Page
Step 5: - After Updating. Service Agreement window will open accept the
Agreement
Step 6: - Install WSL 2 Linux Kernel using the link. After installation Click restart.
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
7|Page
Step 7: - Your Docker is Successfully installed.
8|Page
Lab Experiment: 3
“Working with Docker: Images”
This command is used to display all the images currently installed in system
Return value: The output will return the list of images on the system
9|Page
Docker Inspect
Syntax: docker inspect Repository
10 | P a g e
Lab Experiment: 4
“Working with Docker File”
Part 1: - Creating docker file which give output Image Create when container is
initiated
Step 1: -create docker file with command sudo vim Dockerfile
FROM ubuntu
MAINTAINER anantgargin@gmail.com
Step 2: - Use Command “docker build” for making docker image using Docker file
11 | P a g e
Fig 4.3(Building an image from the dockerfile)
Fig 4.4(Creating a container from the image built from the Dockerfile)
Part 2: - Creating a docker file whose container will evoke java program when
initialized
Step 1: - Create java file
class Hello{
12 | P a g e
Fig 4.6 (Content of “hello.java”)
FROM openjdk:11
COPY . var/www/java
WORKDIR /var/www/java
13 | P a g e
Step 3: -Create the docker image from docker file
14 | P a g e
Lab Experiment: 5
“Docker Public Repository”
Step 1: -Log into docker hub and create your repository. This is the repository where your
image will be stored.
Step 2: - Click on the button “Create a Repository” on the above screen and create a
repository. Make sure the visibility of repository is public. Once the repository is created,
make a note of pull command which is attached to the repository.
15 | P a g e
Fig 5.2(Creating a public repository in docker hub)
Step 3: - Issue the docker login command to login into the docker hub repository from the
command prompt. The docker login command will prompt you for the username and
password to docker hub repository
Step 4: - Once the image has been tagged it’s now time to push the image to the Docker
Hub repository. We cad do this using docker push command
16 | P a g e
Fig 5.6(Pushing the tagged image into the public repository that we created online)
17 | P a g e
Lab Experiment: 6
“Managing Ports in Docker”
18 | P a g e
Step 3: - Pull the Jenkins to your Ubuntu server using “docker pull jenkins” from docker hub
Step4: - use Docker inspect command to inspect the docker image “docker inspect
jenkins/jenkins:latest”
19 | P a g e
Fig 6.5 (Here you can see that Exposed Ports are 8080 and 50000)
Step 5: - run the command to run the Jenkins on container with 8080 port open
Command: - docker run -p 8080:8080 -p 50000:50000 --name=jenk -d jenkins/jenkins
/bin/bash
And you can access your Jenkins by going to your browser and going to localhost:8080
20 | P a g e
Lab Experiment: 7
“Docker private registry”
Objectives: -
• Create a private registry
• Tag the previously created image
• Push the image in the private registry
• Delete the local Image
• Pull the image from private registry
Step 1: - Pull the private registry image with port open 5000
21 | P a g e
Step 3: - Now push the new tagged file to the registry
22 | P a g e
Lab Experiment: 8
Docker-Building a Web Server Docker File
Step 2: - Build the docker image using the docker build command
23 | P a g e
Fig 8.3 (Image build successful)
Step 3: - Now Run the web server that have been build
24 | P a g e
Lab Experiment: 9
“Docker: Container linking”
Objectives: -
• Link multiple containers.
• Step by step process of linking containers using link flag
Steps: -
1) Download the Jenkins image, if it is not already present, using pull command
2) Once the image is available, run the container, but this time, you can specify a name to the
container by using the name option. This will be our source container.
25 | P a g e
3) Next, it is time to launch the destination container, but this time, we will link it with our
source container. For our destination container, we will use the standard Ubuntu image.
26 | P a g e
Lab Experiment: 10
“Installing & Starting in this MiniKube”
Run the curl command below to download a copy of the MiniKube binary on your machine
(minikube-linux-amd64).
In the same directory where the binary was downloaded, run the followingcommand to install the
MiniKube binary (minikube-linux-amd64) to the appropriate location (/usr/local/bin/minikube).
27 | P a g e
Lastly, run the below command to start MiniKube using the installed binary and Run the following
command to get all pods running in all namespaces (-A) in the cluster.
Run the following kubectl command to create a deployment named httpd using the latest image
(httpd:latest).
28 | P a g e
Run the kubectl expose command below to expose your deployment to the outside world with the
standard port 80 using a NodePort service and Note down the URL like in the output below, as you’ll
need it to access your web.
Fig5(get url)
Fig6(get result)
29 | P a g e