KEMBAR78
Cloud Computing Lab Manual | PDF | Apache Hadoop | Computer File
0% found this document useful (0 votes)
36 views77 pages

Cloud Computing Lab Manual

The document outlines the practical work for the CCS335 - Cloud Computing Laboratory course, detailing various exercises such as creating virtual machines, installing compilers, and deploying web applications using Google App Engine. It includes a bonafide certificate for the student's work and a table of contents listing the practical exercises. Each exercise provides aims, procedures, and results, demonstrating the application of cloud computing concepts.

Uploaded by

jebas5294
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views77 pages

Cloud Computing Lab Manual

The document outlines the practical work for the CCS335 - Cloud Computing Laboratory course, detailing various exercises such as creating virtual machines, installing compilers, and deploying web applications using Google App Engine. It includes a bonafide certificate for the student's work and a table of contents listing the practical exercises. Each exercise provides aims, procedures, and results, demonstrating the application of cloud computing concepts.

Uploaded by

jebas5294
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

Department of Computer Science and Engineering

CCS335 – CLOUD COMPUTING LABORATORY

Name :

Roll No. : Register No.

Semester: V Branch: Computer Science And Engineering


Department of Computer Science and Engineering
BONAFIDE CERTIFICATE

Certified that this practical work entitles CCS335 – CLOUD COMPUTING

LABORATORY is the bonafide record of work done by Mr. /Ms. _ of

the V Semester in Department of Computer Science and Engineering during the period AUGUST-

DECEMBER 2024.

Register No.

Staff in – Charge Head of the Department

Submitted for the Anna University B.E Degree Practical Examination held at Nellai College of
Engineering on .

Internal Examiner External Examiner


Table of Contents

Sl. No Date Title Page No Signature

1 INSTALLING & CREATING A VIRTUAL


MACHINE USING VMWARE SOFTWARE

2 INSTALLING A C COMPILER IN VIRTUAL


BOX

3 GOOGLE APP ENGINE PYTHON HELLO


WORLD EXAMPLE USING ECLIPSE

4 USE GAE LAUNCHER TO LAUNCH A WEB


APPLICATIONS

5 COPY FILES FROM ONE VIRTUAL


MACHINE TO ANOTHER

6 INSTALL HADOOP SINGLE NODE CLUSTER

7
SIMULATE A CLOUD SCENARIO USING
CLOUDSIM AND RUN A SCHEDULING
ALGORITHM

8
CREATING AND EXECUTING YOUR FIRST
CONTAINER USING DOCKER

9
RUN A CONTAINER FROM DOCKER HUB
N

INSTALLING & CREATING A VIRTUAL MACHINE


Ex.No.1 USING VMWARE SOFTWARE

AIM:

To Install & Create a virtual machine using VMware Software

PROCEDURE:
Open the Virtual Machine Software

1
PRO

vmvva‹e

PRO

vmvva‹e

2
3
RESULT:

Thus the virtual machine creation using vmware was installed and executed successfully.

4
Ex.No.2 INSTALLING A C COMPILER IN VIRTUAL BOX

AIM
To install GCC the C compiler on Ubuntu 18.04 Bionic Beaver and execute simple programs.

OPERATING SYSTEM AND SOFTWARE VERSIONS

 Operating System: - Ubuntu 18.04 Bionic Beaver

REQUIREMENTS
Privileged access to your Ubuntu System as root or via sudo command is required.

PROCEDURE:

Install GCC

The following linux command will install gcc compiler on on Ubuntu 18.04 Bionic Beaver. Open up terminal

and enter:
$ sudo apt install gcc

Install build-essential

Another way to install gcc compiler is to install it as part of build-essential package. build-essential package
will also install additional libraries as well as g++ compiler. In most cases or if unsure this is exactly what you
need:
$ sudo apt install build-essential

Check GCC version

Confirm your installation by checking for GCC version:


$ gcc --version
gcc (Ubuntu 7.2.0-18ubuntu2) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

C Hello World

Compile a simple C "Hello World" code:


#include <stdio.h>

5
int main()
{
printf("Hello, World!");
return 0;
}
Save the above code within hello.c file, compile and execute it:
$ gcc -o hello hello.c
$ ./hello
Hello, World!

Installing compilers using apt command

Open the terminal app and type the following apt command/apt-get command:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install build-essential
OR
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential
Sample outputs:

Verify installation

Type the following commands:


$ whereis gcc make
$ gcc --version
$ make -v

6
RESULT:
Thus the Gcc compiler was installed and executed the simple programs successfully.

7
Ex.No.3 USE GAE LAUNCHER TO LAUNCH A WEB APPLICATIONS

AIM:
To launch a web application using GAE.

PROCEDURE:

Step 1. Download the basic housekeeping stuff

1. Download Python 2.7


2. Download Google Cloud SDK.
3. Set the Python path in the Google App Engine launcher
After downloading the SDK, launch the App Engine launcher, go to Edit -> Preferences and make sure
4. you set the path for where you installed Python in step 1 above

8
Set the Python path in Google App Engine launcher

Step 2. App Engine sign-up

This is often the most confusing part of the entire setup. Things you should know when you sign-up:

1. Currently, App Engine offers a free trial for one year.


2. The trial includes $300 of credit that can be used during the one year trial period.
3. You will need to add a credit card to sign-up (for verification purposes).
4. You will not be charged during the sign-up process.
5. You will not be charged during the trial period as long as you do not cross the credit limit offered.

Here are the steps you need to follow to sign-up:

1. Go to the Google Cloud landing page


2. Follow the sign-up process and go to your App Engine dashboard

Most of the hard work is complete after a successful sign-up.

Step 3. Create a new project

The next step is to create a new Python project that you can work on. Follow the screenshots below to create a

new project.

Launch the new project wizard.

9
Give your app a name and make a note of your project ID.

Hit the create button and Google should take a few minutes to set up all that is necessary for your newly created

app.

Step 4. Fork the app to develop it locally

The next step in the process is to fork the app on your local machine. This will allow you to make changes to the app
locally and deploy it whenever you wish to.

Go to Google App Engine launcher and create a new application.

10
Enter the project ID of your newly created app. Also, provide the folder (local destination) where you wish to

store the app locally. Make sure you select the Python 2.7 as your runtime engine.

Hit the create button, and you should see your app listed on the window that follows. You should also check that

you now see some files in your local storage (the directory you chose in the screenshot above) after this step.

Step 5. Run the app locally

11
Before you go ahead and make some changes to the app, it is important to check whether or not you have

executed all the above steps correctly. This can be done by simply running the app locally.

Select the app and hit the run button on the window.

Wait for a few seconds until you can hit the Browse button. Once the Browse button becomes clickable,

click it. This should take you to the browser, and you should see the hello world text appear in your

browser window. Alternatively, you can manually go to the browser and use the port specified to access

the app.

As long as you see the above screen, you are all set.

Step 6. Understand the app structure

It is finally time to look at the lines of code which are running this webapp. Open your app folder in the text

editor of your choice. I recommend Sublime text or VS Code. However, feel free to choose the one you prefer.

Here is a description of the various files.

app.yaml

This file is a basic markup file that stores information (some metadata) about the app. It is important to note

the following crucial parts of the file.

1. application
This is the project ID which you should never change. This is the unique identifier for the app
2. urlscript
This is the homepage for the app. In other words, this file will be rendered in your browser when you
3. launch the app

12
4. libraries
This is where you can include external libraries to use within the webapp

app.yaml file in the webapp folder

main.py

This is the homepage of the app (as discussed above). Note that the hello world text in the browser window

(step 5) is due to the code you see highlighted below.

main.py file in the webapp folder

Step 7. Make your changes and deploy the new app

No hello world app is ever complete without the developer changing the hello world text to something else

just to make sure that everything happening behind the scenes is working as it should.

Go ahead and change the text in the above screenshot to something else.

main.py file in the webapp folder

Save the changes, go to the browser and refresh the page. You should see the page with the text “MEOW”

displayed.

Finally, it is time to deploy your changes to the cloud to make them globally accessible via a URL. Go to the

App Engine launcher, select the app, and hit the Deploy button.

This will ensure your app gets deployed onto Google Cloud. To check whether or not everything worked just

fine, go to the URL below:

https://<yourProjectID>.appspot.com/

You should see the exact same window as above, expect now, it is a URL that is globally accessible.

RESULT:
Thus a web application was launched successfully using GAE.

13
Ex.No.4 GOOGLE APP ENGINE PYTHON HELLO WORLD EXAMPLE USING
ECLIPSE

AIM:

To create a Google App Engine (GAE) Python web project (hello world)using Eclipse.

TOOLS USED :

1. Python 2.7
2. Eclipse 3.7 + PyDev plugin
3. Google App Engine SDK for Python 1.6.4

PROCEDURE:

P.S Assume Python 2.7 and Eclipse 3.7 are installed.

Step:1. Install PyDev plugin for Eclipse

Use following URL to install PyDev as Eclipse plugin.

http://pydev.org/updates

Figure 1 – In Eclipse , menu, “Help –> Install New Software..” and put above URL. Select “PyDev for

Eclipse” option, follow steps, and restart Eclipse once completed.

14
Step 2. Verify PyDev

After Eclipse is restarted, make sure PyDev’s interpreter is pointed to your “python.exe“.

Figure 2 – Eclipse -> Windows –> Preferences, make sure “Interpreter – Python” is configured properly.

15
Step:3. Google App Engine SDK Python

Download and install Google App Engine SDK for Python.

Step:4. Python Hello World in Eclipse

Following steps to show you how to create a GAE project via Pydev plugin.

Figure 4.1 – Eclipse menu, File -> New -> Other… , PyDev folder, choose “PyDev Google App Engine

Project“.

16
Figure 4.2 – Type project name, if the interpreter is not configure yet (in step 2), you can do it now. And select

this option – “Create ‘src’ folder and add it to PYTHONPATH“.

17
Figure 4.3 – Click “Browse” button and point it to the Google App Engine installed directory (in step 3).

18
Figure 4.4 – Name your application id in GAE, type anything, you can change it later. And choose “Hello

Webapp World” template to generate the sample files.

19
Figure 4.5 – Done, 4 files are generated, Both “.pydevproject” and “.project” are Eclipse project files, ignore it.

Review the generated Python’s files :

File : helloworld.py – Just output a hello world.

from google.appengine.ext import webapp


from google.appengine.ext.webapp.util import run_wsgi_app

class MainPage(webapp.RequestHandler):

20
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')

application = webapp.WSGIApplication([('/', MainPage)], debug=True)

def main():
run_wsgi_app(application)

if name == " main ":


main()
Copy

File : app.yaml – GAE need this file to run and deploy your Python project, it’s quite self-explanatory, for

detail syntax and configuration, visit yaml and app.yaml reference.

application: mkyong-python
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
script: helloworld.py
Copy
Step:5. Run it locally

To run it locally, right click on the helloworld.py, choose “Run As” –> “Run Configuration”, create a new

“PyDev Google App Run“.

Figure 5.1 – In Main tab -> Main module, manually type the directory path of “dev_appserver.py“.

“Browse” button is not able to help you, type manually.

21
Figure 5.2 – In Arguments tab -> Program arguments, put “${project_loc}/src“.

22
Figure 5.3 – Run it. By default, it will deploy to http://localhost:8080.

Figure 5.4 – Done.

5. Deploy to Google App Engine

Register an account on https://appengine.google.com/, and create an application ID for your web

application. Review “app.yaml” again, this web app will be deployed to GAE with application ID

“mkyong-python“.

File : app.yaml

application: mkyong-python
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
script: helloworld.py
Copy

23
To deploy to GAE, see following steps :

Figure 5.1 – Create another new “PyDev Google App Run”, In Main tab -> Main module, manually type

the directory path of “appcfg.py“.

Figure 5.2 – In Arguments tab -> Program arguments, put “update ${project_loc}/src“.

24
Figure 5.3 – During deploying process, you need to type your GAE email and password for authentication.

Figure 5.4 – If success, the web app will be deployed to – http://mkyong-python.appspot.com/.

25
Done.

RESULT:

Thus hello world web application was created using Google App Engine.

26
Ex.No.5
COPY FILES FROM ONE VIRTUAL MACHINE TO ANOTHER

AIM:

To write a procedure to copy files from one virtual machine to another

PROCEDURE:

1. Create one shared folder in virtual box

VirtualBox

VirtualBox’s Shared Folders feature works with both Windows and Linux guest operating systems. To use

the feature, you first need to install VirtualBox’s Guest Additions in the guest virtual machine.

With the virtual machine running, click the “Devices” menu and choose the “Insert Guest Additions CD

image” option. This inserts a virtual CD that you can use within the guest operating system to install the

Guest Additions.

27
After the Guest Additions are installed, open the “Machine” menu and click the “Settings” option.

In the “Settings” window, switch to the “Shared Folders” tab. Here you can see any shared folders you’ve

set up. There are two types of shared folders. Machine Folders are permanent folders that are shared until

you remove them. Transient Folders are temporary and are automatically removed when you restart or shut down

the virtual machine.

Click the “Add” button (the folder with a plus on it) to create a new shared folder.

28
In the “Add Share” window, you can specify the following:

 Folder Path: This is the location of the shared folder on your host operating system (your real PC).
 Folder Name: This is how the shared folder will appear inside the guest operating system.
 Read-only: By default, the virtual machine has full read-write access to the shared folder. Enable the
 “Read-only” checkbox if you want the virtual machine only to be able to read files from the shared
 folder, but not modify them.
 Auto-mount: This option makes the guest operating system attempt to automatically mount the folder
 when it boots.
 Make Permanent: This option makes the shared folder a Machine Folder. If you don’t select this
 option, it becomes a transient folder that is removed with the virtual machine restarts.

Make all your choices and then hit the “OK” button.

29
You should now see the shared folders appear as network file shares. If you’re using a Windows guest

operating system, open File Explorer, select “Network”, and then look under the “VBOXSRV” computer.

30
RESULT:

Thus a procedure to copy files from one virtual ,machine to another virtual machine was executed successfully.

31
Ex.No.6
INSTALL HADOOP SINGLE NODE CLUSTER

AIM:
To write a procedure to install a single node Hadoop cluster

PROCEDURE:.
Java

Download the Java 1.8 from https://java.com/en/download/

Once installed confirm that you’re running the correct version from command line using ‘java -version’

command, output of which you can confirm in command line like this:

WinRAR

I’ve downloaded and installed WinRAR 64 bit release from http://www.rarlab.com/download.htm that will

later allow me to decompress Linux type tar.gz packages on Windows.

Hadoop

The next step was to install a Hadoop distribution. To do so, I’ve decided to download the most recent

release Hadoop 3.0.0-alpha2 (25 Jan, 2017) in a binary form, from the Apache Download

Mirror at http://hadoop.apache.org/releases.html

Once the hadoop-3.0.0-alpha2.tar.gz (250 MB) downloaded, I’ve extracted it by using WinRAR (installed in

the previous step) into C:\hadoop-3.0.0-alpha2 folder:

32
Now that I had Hadoop downloaded, it was time to start the Hadoop cluster with a single node.

Setup Environmental Variables

In Windows 10 I’ve opened System Properties windows and clicked on Environment Variables button:

33
hen created a new HADOOP_HOME variable and pointed the path to C:\hadoop-3.0.0-alpha2\bin folder on my

PC:

Next step was to add a Hadoop bin directory path to PATH variable. Clicked on PATH and pressed edit:

Then added a ‘C:\hadoop-3.0.0-alpha2\bin’ path like this and pressed OK:

34
Edit Hadoop Configuration

C:\hadoop-3.0.0-alpha2\etc\hadoop\core-site.xml file, just like this:

35
Next go to C:\hadoop-3.0.0-alpha2\etc\hadoop folder and renamed mapred-site.xml.template to mapred-site.xml.

edited the mapred-site.xml file adding the following XML Yarn configuration for Mapreduce:

<configuration>

<property>

<name>mapreduce.framework.name</name>

36
<value>yarn</value>

</property>

</configuration>

This is what the file looks like when configured:

37
The next step was to created a new ‘data’ folder in Hadoop’s home directory (C:\hadoop-3.0.0-alpha2\data).

Once done, the next step was to add a data node and name node to Hadoop, by editing

c:\hadoop-3.0.0-alpha2\etc\hadoop\hdfs-site.xml file.

And added following configuration to this XML file:

configuration>

<property> <name>dfs.replication</name> <value>1</value> </property> <property>


<name>dfs.namenode.name.dir</name> <value>C:/hadoop-3.0.0-alpha2/data/namenode</value>
</property><property> <name>dfs.datanode.data.dir</name> <value>C:/hadoop-3.0.0-
alpha2/data/datanode</value> </property></configuration>

In above step, I had to make sure that I am pointing to location of my newly created data folder and append the
datanode and namenode as shown in example.

This is what hdfs-site.xml file looked like once completed:

38
The next step was to add site specific YARN configuration properties by editing yarn-site.xml at

C:\hadoop-3.0.0-alpha2\etc\hadoop\yarn-site.xml, like this:

<configuration> <property>

<name>yarn.nodemanager.aux-services</name>

<value>mapreduce_shuffle</value> </property>

<property>

<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>

39
<value>org.apache.hadoop.mapred.ShuffleHandler</value>

</property>

</configuration>

This is what yarn-site.xml file looked like once completed:

Then I continued by editing hadoop-env.cmd in C:\hadoop-3.0.0-alpha2\etc\hadoop\hadoop-env.cmd. Then

changed the line for JAVA_HOME=%JAVA_HOME% and added a path to my JAVA

folder: C:\PROGRA~1\Java\JDK18~1.0_1

Go to C:\Program Files\Java\jdk1.8.0_111 where my Java JDK is installed and converted a long path to

windows short name:

40
Next step was to open hadoop-env.cmd and add it in there, as shown in this screenshot:

Next in C:\hadoop-3.0.0-alpha2\bin using windows command prompt as admin run:

‘hdfs namenode -format’ command.

Output looked like this:

41
Then I’ve finally started Hadoop. I’ve opened command prompt as admin in C:\hadoop-3.0.0-alpha2\sbin and

ran

start-dfs.cmd and also start-yarn.cmd, like this:

Open Hadoop GUI

Once all above steps were completed, I’ve opened browser and navigated to: http://localhost:8088/cluster

42
All Applications

43
WORD COUNT PROGRAM:

Then go to https://www.randomlists.com/random-words to create couple of random words:

44
untidy strRngthRn bl0t 9X RCt
CClmmand unkempt right surcinct
reach ITI00[ 59Rd äppfCIVäl
van defeated lake j0bless
I10II0W fRpl\ BWe.5OITI9 bubble
kindly inform deScriptiV9 W00d
US? t[Ip [RgM9St irritating
thumb idRntify acti0n shift
jumpy gabby sClre COITI lete
achiever lÏCRn5R Bbu5ive uniquR
pull lackadaisical squash elite
tärt Cf0SS 8LlCk changeable
deC0rät9 b0rde.r r0nfess sma5h
watch undRrStCl0d p0Mr StÏ[
tender m00[ ITl9äSMfe black
preach nClisy dark glistRning
CDlOMf fMl9 peck trite
blRBch marblR 5C0ld suggest
WäStRfMl p0t angry baskRt
St0p br0äd [Rbel shClRS
radiatR neat ädmit b0unce
0bjeCt W9II-tLl-dCI fTicti0n fold
bashful mark Cl0th MälD
0rangR air CClMgh mug
f9lRäS9 fIäp bl00d quarrelsome

Then save words to words.txt,

45
Running Wordlist against Hadoop’s MapReduce

Once I ran my code, it executed and started processing the words.txt file that was prior to execution copied to

input folder (which I created earlier together with the output folder for the outcome files).

Following was the result of Hadoop’s processing job:

46
We can see the job progress in the browser as well:

OUTPUT:

1. abusive 1
2. achiever 1
3. action 1
4. admit 1
5. air 1
6. angry 1
7. approval 1
8. awesome 1
9. bashful 1
10. basket 1
11. black 1
12. bleach 1
13. blood 1
14. blot 1
15. border 1
16. bounce 1
17. broad 1
18. bubble 1
19. changeable 1
20. cloth 1
21. colour 1
22. command 1
23. confess 1

47
24. cough 1
25. cross 1
26. dark 1
27. decorate 1
28. defeated 1
29. descriptive 1
30. elite 1
31. expect 1
32. flap 1
33. flock 1
34. fold 1
35. friction 1
36. gabby 1
37. hollow 1
38. identify 1
39. inform 1
40. irritating 1
41. jarosciak 5
42. jobless 1
43. jumpy 1
44. kindly 1
45. lackadaisical 1
46. lake 1
47. license 1
48. male 1
49. marble 1
50. mark 1
51. measure 1
52. moor 2
53. mug 1
54. neat 1
55. noisy 1
56. object 1
57. orange 1
58. peck 1
59. pot 1
60. pour 1
61. preach 1
62. pull 1
63. quarrelsome 1
64. radiate 1
65. reach 1
66. rebel 1
67. release 1
68. reply 1
69. request 1
70. right 1

48
71. scold 1
72. seed 1
73. sheet 1
74. shoes 1
75. smash 1
76. sore 1
77. squash 1
78. stir 1
79. stop 1
80. strengthen 1
81. succinct 1
82. suggest 1
83. tart 1
84. taste 1
85. thumb 1
86. trip 1
87. trite 1
88. understood 1
89. unique 1
90. unkempt 1
91. untidy 1
92. van 1
93. wasteful 1
94. watch 1
95. well-to-do 1
96. wood 1

RESULT:
Thus a procedure to install single node Hadoop cluster was successfully executed.

49
Ex.No.7 Simulate a Cloud Scenario using CloudSim and Run a Scheduling Algorithm

Aim:
To Simulate a Cloud Scenario using CloudSim and run a Scheduling Algorithm.

Procedure:

Step 1: Download CloudSim installable files from:


https://code.google.com/p/cloudsim/downloads/list and unzip the download

50
Step 2: Open Netbeans and create a new project named “Clousim”

51
Step 3: Type the code and add the jar file to the libraries. The jar file will be in the extracted
cloudsim.

52
Step 4:Run the application

53
OUTPUT:

Step 5:Again create a new project and name it as “Cloudsim2”

54
Step 6:Type the code and include the jar file

55
Step 7:Run the application

56
57
OUTPUT:

Result:
Thus a procedure to Simulate a Cloud Scenario using CloudSim and run a Scheduling Algorithm was
successfully executed.

58
Ex.No.8
Creating and Executing Your First Container Using Docker

Aim:
To Find a procedure to Creating and Executing the First Container Using Docker
Steps:
Prerequisites

Its must have access to a docker client, either on localhost, use a terminal from Theia - Cloud
IDE at https://labs.cognitiveclass.ai/tools/theiadocker or be using Play with Docker for
example. Get Started

Get Started

Run docker -h,


$ docker -h
Flag shorthand -h has been deprecated,
please use --help Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers

...

Management Commands:
builder Manage builds
config Manage Docker configs
container Manage containers
engine Manage the docker engine
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes

59
60
61
62
63
64
65
66
67
68
69
70
71
Ex.No.9
Run a Container from Docker Hub

72
5. Status: Downloaded newer image for hello- world: latest
6. docker.io/library/hello-world:latest
7. Run docker run hello-world to run the image locally. You should see output similar to:
8. $ docker run hello-world
9. Hello from Docker!
10. To generate this message, Docker took the following steps:
11. 1. The Docker client contacted the Docker daemon.
12. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
13. (amd64)
14. 3. The Docker daemon created a new container from that image which runs the
15. executable that produces the output you are currently reading.
16. 4. The Docker daemon streamed that output to the Docker client, which sent
17. it to your terminal.
18.
19. To try something more ambitious, you can run an Ubuntu container with:
20. $ docker run -it ubuntu bash
21.
22. Share images, automate workflows, and more with a free Docker ID:
23. https://hub.docker.com/
24.
25. For more examples and ideas, visit:
26. https://docs.docker.com/get-started/

Step 5: Build and push a container image to Docker Hub from your computer
1. Start by creating a Dockerfile to specify your application as shown below:
2. # syntax=docker/dockerfile:1
3. FROM busybox
CMD echo "Hello world! This is my first Docker image."
4. Run docker build -t <your_username>/my-private-repo . to build your Docker image.
5. Run docker run <your_username>/my-private-repo to test your Docker image locally.
Run docker push <your_username>/my-private-repo to push your Docker image to Docker Hub. You
should see output similar to:

73
NOTE
You must be signed in to Docker Hub through Docker Desktop or the command line, and you must
also name your images correctly, as per the above steps.
Your repository in Docker Hub should now display a new latest tag under Tags

You've successfully:
 Signed up for a Docker account
 Created your first repository
 Pulled an existing container image from Docker Hub
 Built your own container image on your computer
Pushed it successfully to Docker Hub

Result:
Thus the Running a Container from Docker Hub is completed successfully

74

You might also like