Difference between revisions of "Docker/C2/Basics-of-Images-and-Containers/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with "<div style="margin-left:1.27cm;margin-right:0cm;"></div> {| border="1" |- || '''Visual Cue''' || '''Narration''' |- |- style="border:1pt solid #000000;padding-top:0cm;padding-...")
 
Line 1: Line 1:
<div style="margin-left:1.27cm;margin-right:0cm;"></div>
+
 
 
{| border="1"
 
{| border="1"
 
|-
 
|-
 
|| '''Visual Cue'''
 
|| '''Visual Cue'''
 
|| '''Narration'''
 
|| '''Narration'''
|-
+
 
|- style="border:1pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.206cm;padding-right:0.191cm;"
+
|-  
 
|| Show slide:  
 
|| Show slide:  
  
 
'''Welcome'''
 
'''Welcome'''
|| Welcome to the Spoken Tutorial on<span style="color:#ff0000;"> </span>'''Basics of Images and Containers'''.
+
|| Welcome to the Spoken Tutorial on'''Basics of Images and Containers'''.
 
|-
 
|-
 
|| '''Show slide:'''
 
|| '''Show slide:'''
Line 15: Line 15:
  
 
'''Learning Objectives'''
 
'''Learning Objectives'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | In this tutorial, we will learn about
+
|| In this tutorial, we will learn about
* <div style="margin-left:1.27cm;margin-right:0cm;">Images and containers</div>
+
* Images and containers
* <div style="margin-left:1.27cm;margin-right:0cm;">Pulling an image from Docker Hub</div>
+
* Pulling an image from Docker Hub
* <div style="margin-left:1.27cm;margin-right:0cm;">Running an image</div>
+
* Running an image
* <div style="margin-left:1.27cm;margin-right:0cm;">Accessing the running application</div>
+
* Accessing the running application
* <div style="margin-left:1.27cm;margin-right:0cm;">Viewing running containers</div>
+
* Viewing running containers
* <div style="margin-left:1.27cm;margin-right:0cm;">Stopping and starting a container</div>
+
* Stopping and starting a container
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''System Requirements'''
 
'''System Requirements'''
  
 
To record this tutorial, I am using  
 
To record this tutorial, I am using  
* <div style="margin-left:1.27cm;margin-right:0cm;">'''Ubuntu Linux OS 22.04'''</div>
+
* '''Ubuntu Linux OS 22.04'''
* <div style="margin-left:1.27cm;margin-right:0cm;">'''Docker 27.0.2'''</div>
+
* '''Docker 27.0.2'''
  
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | To record this tutorial, I am using
+
|| To record this tutorial, I am using
* <div style="margin-left:1.27cm;margin-right:0cm;">'''Ubuntu Linux '''OS version '''22.04 '''and</div>
+
* '''Ubuntu Linux '''OS version '''22.04 '''and
* <div style="margin-left:1.27cm;margin-right:0cm;">'''Docker version 27.0.2'''</div>
+
* '''Docker version 27.0.2'''
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding:0cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Prerequisite'''
 
'''Prerequisite'''
| style="background-color:transparent;border:0.5pt solid #000000;padding:0cm;" | To follow this tutorial,
+
|| To follow this tutorial,
* <div style="margin-left:1.27cm;margin-right:0cm;">You must have basic knowledge of using Linux terminal</div>
+
* You must have basic knowledge of using Linux terminal
* <div style="margin-left:1.27cm;margin-right:0cm;">For pre-requisite Linux tutorials, please visit this website</div>
+
* For pre-requisite Linux tutorials, please visit this website
 
|-
 
|-
| style="background-color:transparent;border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding:0cm;" | Show slide:
+
|| Show slide:
  
 
'''Code files'''
 
'''Code files'''
| style="border-top:none;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:0.5pt solid #000000;padding:0cm;" |
+
||
* <div style="margin-left:1.27cm;margin-right:0cm;">The files used in this tutorial are provided in the '''Code files''' link.</div>
+
* The files used in this tutorial are provided in the '''Code files''' link.
* <div style="margin-left:1.27cm;margin-right:0cm;">Please download and extract the files.</div>
+
* Please download and extract the files.
* <div style="margin-left:1.27cm;margin-right:0cm;">Make a copy and then use them while practicing.</div>
+
* Make a copy and then use them while practicing.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Docker Images'''
 
'''Docker Images'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | A '''Docker Image '''is an executable package.
+
|| A '''Docker Image '''is an executable package.
  
 
It contains all the files and configurations needed for running an application.
 
It contains all the files and configurations needed for running an application.
Line 59: Line 59:
 
It allows developers to package applications along with all their dependencies.
 
It allows developers to package applications along with all their dependencies.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Docker Containers'''
 
'''Docker Containers'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | A '''Docker container '''is a running instance of a '''Docker image.'''
+
|| A '''Docker container '''is a running instance of a '''Docker image.'''
  
 
Each '''container '''runs as an independent entity.
 
Each '''container '''runs as an independent entity.
  
<span style="background-color:#ffffff;">There can be multiple instances of </span><span style="background-color:#ffffff;">'''Docker containers'''</span><span style="background-color:#ffffff;"> for the same </span><span style="background-color:#ffffff;">'''Docker image.'''</span>
+
There can be multiple instances of '''Docker containers''' for the same '''Docker image.'''
  
 
'''Containers '''share the OS kernel with each other.
 
'''Containers '''share the OS kernel with each other.
Line 72: Line 72:
 
On stopping a container, all the changes made are lost.
 
On stopping a container, all the changes made are lost.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show image:
+
|| Show image:
  
 
Docker Process Flowchart
 
Docker Process Flowchart
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | This flowchart shows the process of downloading and running the '''mongodb '''image.
+
|| This flowchart shows the process of downloading and running the '''mongodb '''image.
  
 
The image will be downloaded from '''Docker Hub'''.
 
The image will be downloaded from '''Docker Hub'''.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Docker Process Flowchart'''
 
'''Docker Process Flowchart'''
  
 
Hover over '''Docker Hub '''block
 
Hover over '''Docker Hub '''block
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | '''Docker Hub '''is an online '''Docker image '''registry.
+
|| '''Docker Hub '''is an online '''Docker image '''registry.
  
 
An image '''registry''' is a storage location for '''Docker '''images.
 
An image '''registry''' is a storage location for '''Docker '''images.
Line 90: Line 90:
 
It allows the pull and push of images.
 
It allows the pull and push of images.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Docker Process Flowchart'''
 
'''Docker Process Flowchart'''
  
 
Hove over '''Docker Official Images '''block
 
Hove over '''Docker Official Images '''block
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | '''Docker Official images''' are a curated set of '''Docker '''repositories on '''Docker Hub'''.
+
|| '''Docker Official images''' are a curated set of '''Docker '''repositories on '''Docker Hub'''.
  
 
Some of the official images are '''python''', '''nodejs '''and '''mongo.'''
 
Some of the official images are '''python''', '''nodejs '''and '''mongo.'''
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Docker Process Flowchart'''
 
'''Docker Process Flowchart'''
  
 
Hove over '''mongo '''block
 
Hove over '''mongo '''block
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | In this tutorial, we will pull the '''mongo official '''image.
+
|| In this tutorial, we will pull the '''mongo official '''image.
  
 
We shall then run it to create a local '''mongodb '''database and connect to it.
 
We shall then run it to create a local '''mongodb '''database and connect to it.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Docker Process Flowchart'''
 
'''Docker Process Flowchart'''
  
 
Hove over '''Docker Container '''block
 
Hove over '''Docker Container '''block
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Using the '''run '''command we will create a container for the image.
+
|| Using the '''run '''command we will create a container for the image.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Docker Process Flowchart'''
 
'''Docker Process Flowchart'''
  
 
Hove over '''Port Mapping '''block
 
Hove over '''Port Mapping '''block
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | We map port 27017 of the container to port 27017 on our system.
+
|| We map port 27017 of the container to port 27017 on our system.
  
 
This allows us to access the application from our system.
 
This allows us to access the application from our system.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Only narration
+
|| Only narration
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Now we shall implement this process on our system.
+
|| Now we shall implement this process on our system.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" |  
+
||  
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Open a terminal by pressing the keys Ctrl, Alt and T simultaneously.  
+
|| Open a terminal by pressing the keys Ctrl, Alt and T simultaneously.  
  
 
Type the command '''sudo space docker space pull space mongo '''in the terminal.
 
Type the command '''sudo space docker space pull space mongo '''in the terminal.
Line 141: Line 141:
 
Please wait for the download to complete.
 
Please wait for the download to complete.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show slide:
+
|| Show slide:
  
 
'''Run Command'''
 
'''Run Command'''
  
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | In order to run the downloaded image, we will use the Docker '''run '''command.  
+
|| In order to run the downloaded image, we will use the Docker '''run '''command.  
  
 
This is the syntax for the run command.
 
This is the syntax for the run command.
Line 157: Line 157:
 
If no name is specified, a random name is assigned.
 
If no name is specified, a random name is assigned.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Switch to the terminal window.
+
|| Switch to the terminal window.
  
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | To run the '''mongo '''image, type the command as shown.
+
|| To run the '''mongo '''image, type the command as shown.
  
<div style="color:#000000;">'''mongo_commands.txt''' '''code '''file has the commands used in this tutorial.</div>
+
'''mongo_commands.txt''' '''code '''file has the commands used in this tutorial.
  
 
You may copy and paste these commands in the terminal instead of typing.
 
You may copy and paste these commands in the terminal instead of typing.
Line 167: Line 167:
 
Remember to Press the '''Enter''' key after each command in the terminal.
 
Remember to Press the '''Enter''' key after each command in the terminal.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight '''--name mongodb-container'''
+
|| Highlight '''--name mongodb-container'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | To set the name of the container, we use the''' hyphen hyphen name''' flag.
+
|| To set the name of the container, we use the''' hyphen hyphen name''' flag.
  
 
Here we set the name of the container to '''mongodb hyphen container.'''
 
Here we set the name of the container to '''mongodb hyphen container.'''
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight
+
|| Highlight
  
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | We can set '''environment variables''' for the application using the hyphen e flag.
+
|| We can set '''environment variables''' for the application using the hyphen e flag.
  
 
Here we set the '''root user '''variable.
 
Here we set the '''root user '''variable.
Line 182: Line 182:
 
The value is '''mongouser'''.
 
The value is '''mongouser'''.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight
+
|| Highlight
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Then we set the '''MONGO underscore INITDB underscore ROOT underscore PASSWORD '''variable.
+
|| Then we set the '''MONGO underscore INITDB underscore ROOT underscore PASSWORD '''variable.
  
 
This variable sets the '''root '''user password.
 
This variable sets the '''root '''user password.
Line 191: Line 191:
 
We will use this password later when we connect to the '''mongodb '''database.
 
We will use this password later when we connect to the '''mongodb '''database.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight '''-p 127.0.0.1:27017:27017'''
+
|| Highlight '''-p 127.0.0.1:27017:27017'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Next, we need to bind the host port to the container port using the '''hyphen p flag'''.
+
|| Next, we need to bind the host port to the container port using the '''hyphen p flag'''.
  
 
Port binding is required to access the container application from our local system.
 
Port binding is required to access the container application from our local system.
Line 206: Line 206:
 
This means that the '''mongodb '''database will be accessible on port 27017 on our system.
 
This means that the '''mongodb '''database will be accessible on port 27017 on our system.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight '''-d'''
+
|| Highlight '''-d'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Then we use the '''hyphen d''' flag to run the container in '''detached mode'''.
+
|| Then we use the '''hyphen d''' flag to run the container in '''detached mode'''.
  
 
'''Detached mode''' allows the container to run in the background.
 
'''Detached mode''' allows the container to run in the background.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight '''mongo'''
+
|| Highlight '''mongo'''
  
 
Press Enter
 
Press Enter
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" |  
+
|| Finally, we will specify the name of the image to be run.
 
+
Finally, we will specify the name of the image to be run.
+
  
 
The name of the image is '''mongo'''.
 
The name of the image is '''mongo'''.
Line 222: Line 220:
 
Press '''Enter''' to execute the command.
 
Press '''Enter''' to execute the command.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight the output of the command.
+
|| Highlight the output of the command.
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | On executing the '''run '''command, we get the id of the container as the output.
+
|| On executing the '''run '''command, we get the id of the container as the output.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Type '''sudo docker ps'''
+
|| Type '''sudo docker ps'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | In order to view the running containers, we use the '''ps '''command.
+
|| In order to view the running containers, we use the '''ps '''command.
  
<div style="color:#000000;">Type '''sudo space docker space ps '''</div>
+
Type '''sudo space docker space ps '''
  
<div style="color:#000000;">Press Enter.</div>
+
Press Enter.
  
 
Enter the password if prompted
 
Enter the password if prompted
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight the container id of the container '''mongodb-container'''.
+
|| Highlight the container id of the container '''mongodb-container'''.
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | You can see the details of the container we created earlier.  
+
|| You can see the details of the container we created earlier.  
  
 
It shows the '''container id, image, command, status, ports and the name'''.
 
It shows the '''container id, image, command, status, ports and the name'''.
Line 242: Line 240:
  
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Type  
+
|| Type  
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Now let us connect to this database using '''exec''' command.
+
|| Now let us connect to this database using '''exec''' command.
  
 
Type the command as shown.
 
Type the command as shown.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight '''mongo-container'''
+
|| Highlight '''mongo-container'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Here the '''mongodb hyphen container '''is the Docker container running the mongodb database.
+
|| Here the '''mongodb hyphen container '''is the Docker container running the mongodb database.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight '''mongosh'''
+
|| Highlight '''mongosh'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | '''Mongosh '''is the command that we are executing.
+
|| '''Mongosh '''is the command that we are executing.
  
 
Mongosh is a shell for interacting with the mongodb database.
 
Mongosh is a shell for interacting with the mongodb database.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight  
+
|| Highlight  
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Then we specify the username and password.
+
|| Then we specify the username and password.
  
 
These were previously set in the run command.
 
These were previously set in the run command.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Press Enter.
+
|| Press Enter.
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Press Enter.
+
|| Press Enter.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight '''test>'''
+
| | Highlight '''test>'''
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | You will be connected to the '''test '''database.
+
|| You will be connected to the '''test '''database.
 
|-
 
|-
| style="border:1pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.106cm;padding-right:0.176cm;" | Type '''show dbs;''' and press Enter.
+
|| Type '''show dbs;''' and press Enter.
| style="border-top:1pt solid #000000;border-bottom:1pt solid #000000;border-left:none;border-right:1pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.106cm;padding-right:0.176cm;" | Type '''show space dbs semicolon''' and press Enter.
+
| | Type '''show space dbs semicolon''' and press Enter.
  
 
You can see the available databases now.
 
You can see the available databases now.
Line 273: Line 271:
 
These are '''admin, config '''and '''local.'''
 
These are '''admin, config '''and '''local.'''
 
|-
 
|-
| style="border:1pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.106cm;padding-right:0.176cm;" | Type '''Ctrl + D '''keys simultaneously.
+
|| Type '''Ctrl + D '''keys simultaneously.
| style="border-top:1pt solid #000000;border-bottom:1pt solid #000000;border-left:none;border-right:1pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.106cm;padding-right:0.176cm;" | To exit the shell, press '''Ctrl '''and '''D '''keys simultaneously.
+
| | To exit the shell, press '''Ctrl '''and '''D '''keys simultaneously.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" |  
+
||  
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | In order to stop the '''mongodb '''container, we use the '''stop '''command.
+
|| In order to stop the '''mongodb '''container, we use the '''stop '''command.
  
 
Type '''sudo space docker space stop space mongodb hyphen container.'''
 
Type '''sudo space docker space stop space mongodb hyphen container.'''
Line 285: Line 283:
 
Press Enter.
 
Press Enter.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Type '''sudo docker ps -a '''and press Enter.
+
|| Type '''sudo docker ps -a '''and press Enter.
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | To verify that the container has been stopped, use the ps command.
+
|| To verify that the container has been stopped, use the ps command.
  
<div style="color:#000000;">Type '''sudo space docker space ps space hyphen a.'''</div>
+
Type '''sudo space docker space ps space hyphen a.'''
  
<div style="color:#000000;">The '''hyphen a''' flag allows us to view all the containers on our system.</div>
+
The '''hyphen a''' flag allows us to view all the containers on our system.
  
<div style="color:#000000;">This includes stopped containers.</div>
+
This includes stopped containers.
  
<div style="color:#000000;">Press Enter.</div>
+
Press Enter.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Highlight the output.
+
|| Highlight the output.
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | The status '''exited '''denotes that the container has been stopped.
+
|| The status '''exited '''denotes that the container has been stopped.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Only narration.
+
|| Only narration.
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | In order to remove a container, we use the '''rm '''command.
+
|| In order to remove a container, we use the '''rm '''command.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Type the command '''sudo docker rm mongodb-container'''
+
|| Type the command '''sudo docker rm mongodb-container'''
  
 
Highlight '''mongodb-container.'''
 
Highlight '''mongodb-container.'''
  
 
Press Enter.
 
Press Enter.
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Type the command as shown here.
+
|| Type the command as shown here.
  
 
The '''rm '''command is followed by the name of the container.
 
The '''rm '''command is followed by the name of the container.
Line 313: Line 311:
 
Press Enter to execute the command.
 
Press Enter to execute the command.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Type the command '''sudo docker ps -a '''and press Enter.
+
|| Type the command '''sudo docker ps -a '''and press Enter.
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Now type '''sudo space docker space ps space hyphen a.'''
+
|| Now type '''sudo space docker space ps space hyphen a.'''
  
 
Press Enter.
 
Press Enter.
Line 320: Line 318:
 
The container should be deleted and not be listed.
 
The container should be deleted and not be listed.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Summary'''
 
'''Summary'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | This brings us to the end of this tutorial. Let us summarise.
+
|| This brings us to the end of this tutorial. Let us summarise.
  
 
In this tutorial, we have learnt about
 
In this tutorial, we have learnt about
* <div style="margin-left:1.27cm;margin-right:0cm;">Images and containers</div>
+
* Images and containers
* <div style="margin-left:1.27cm;margin-right:0cm;">Pulling an image from Docker Hub</div>
+
* Pulling an image from Docker Hub
* <div style="margin-left:1.27cm;margin-right:0cm;">Running an image</div>
+
* Running an image
* <div style="margin-left:1.27cm;margin-right:0cm;">Accessing the running application</div>
+
* Accessing the running application
* <div style="margin-left:1.27cm;margin-right:0cm;">Viewing running containers</div>
+
* Viewing running containers
* <div style="margin-left:1.27cm;margin-right:0cm;">Stopping and starting a container</div>
+
* Stopping and starting a container
  
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | As an assignment, please do the following:
+
|| As an assignment, please do the following:
* <div style="margin-left:1.27cm;margin-right:0cm;">Pull the official image of Python from Docker Hub</div>
+
* Pull the official image of Python from Docker Hub
* <div style="margin-left:1.27cm;margin-right:0cm;">Run the image with the -it flag to run in interactive mode.</div>
+
* Run the image with the -it flag to run in interactive mode.
* <div style="margin-left:1.27cm;margin-right:0cm;">Check the version of Python when the image is run</div>
+
* Check the version of Python when the image is run
* <div style="margin-left:1.27cm;margin-right:0cm;">Check the version of Python in your local machine using command python3 –version</div>
+
* Check the version of Python in your local machine using command python3 –version
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show slide:
+
|| Show slide:
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | The version of Python on my system is 3 point 10 point 12.
+
|| The version of Python on my system is 3 point 10 point 12.
  
 
This version may be different for you.
 
This version may be different for you.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show slide:
+
|| Show slide:
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | On executing the run command with the hyphen '''it '''flag, the Python shell will open.
+
|| On executing the run command with the hyphen '''it '''flag, the Python shell will open.
  
 
We can run Python commands in this shell.
 
We can run Python commands in this shell.
Line 357: Line 355:
 
This version may be different for you.
 
This version may be different for you.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide: '''About Spoken Tutorial project'''
+
|| Show Slide: '''About Spoken Tutorial project'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | The video at the following link summarises the '''Spoken Tutorial project'''.
+
|| The video at the following link summarises the '''Spoken Tutorial project'''.
  
 
Please download and watch it
 
Please download and watch it
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.095cm;padding-right:0.191cm;" | Show Slide: '''Spoken Tutorial Workshops'''
+
|| Show Slide: '''Spoken Tutorial Workshops'''
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;" | <span style="background-color:#ffffff;">The&nbsp;</span><span style="background-color:#ffffff;">'''Spoken Tutorial Project'''</span><span style="background-color:#ffffff;">&nbsp;team </span>conducts workshops and gives certificates.
+
|| The&nbsp;'''Spoken Tutorial Project'''&nbsp;team conducts workshops and gives certificates.
  
 
For more details, please write to us.
 
For more details, please write to us.
 
|-
 
|-
| style="background-color:#ffffff;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.095cm;padding-right:0.191cm;" | Show Slide:
+
|| Show Slide:
  
 
'''Answers for THIS Spoken Tutorial'''
 
'''Answers for THIS Spoken Tutorial'''
| style="background-color:#ffffff;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.095cm;padding-right:0.191cm;" | Please post your timed queries in this forum.
+
|| Please post your timed queries in this forum.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show Slide: '''FOSSEE Forum'''
+
|| Show Slide: '''FOSSEE Forum'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | For any general or technical questions on '''Docker''', visit the FOSSEE forum and post your question.
+
|| For any general or technical questions on '''Docker''', visit the FOSSEE forum and post your question.
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Slide: '''Acknowledgement'''
+
|| Slide: '''Acknowledgement'''
 
+
|| Spoken Tutorial Project was established by the Ministry of Education, Government of India
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Spoken Tutorial Project was established by the Ministry of Education, Government of India
+
 
|-
 
|-
| style="background-color:transparent;border-top:0.5pt solid #000000;border-bottom:0.5pt solid #000000;border-left:0.5pt solid #000000;border-right:none;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | Show slide:
+
|| Show slide:
  
 
'''Thank You'''
 
'''Thank You'''
| style="background-color:transparent;border:0.5pt solid #000000;padding-top:0cm;padding-bottom:0cm;padding-left:0.092cm;padding-right:0.191cm;" | This is Karthik Chandrasekhar, a FOSSEE Semester Long Intern 2024, IIT Bombay signing off.
+
|| This is Karthik Chandrasekhar, a FOSSEE Semester Long Intern 2024, IIT Bombay signing off.
  
 
Thanks for joining.
 
Thanks for joining.
 
|-
 
|-
 
|}
 
|}

Revision as of 13:04, 14 November 2024

Visual Cue Narration
Show slide:

Welcome

Welcome to the Spoken Tutorial onBasics of Images and Containers.
Show slide:


Learning Objectives

In this tutorial, we will learn about
  • Images and containers
  • Pulling an image from Docker Hub
  • Running an image
  • Accessing the running application
  • Viewing running containers
  • Stopping and starting a container
Show Slide:

System Requirements

To record this tutorial, I am using

  • Ubuntu Linux OS 22.04
  • Docker 27.0.2
To record this tutorial, I am using
  • Ubuntu Linux OS version 22.04 and
  • Docker version 27.0.2
Show Slide:

Prerequisite

To follow this tutorial,
  • You must have basic knowledge of using Linux terminal
  • For pre-requisite Linux tutorials, please visit this website
Show slide:

Code files

  • The files used in this tutorial are provided in the Code files link.
  • Please download and extract the files.
  • Make a copy and then use them while practicing.
Show Slide:

Docker Images

A Docker Image is an executable package.

It contains all the files and configurations needed for running an application.

It allows developers to package applications along with all their dependencies.

Show Slide:

Docker Containers

A Docker container is a running instance of a Docker image.

Each container runs as an independent entity.

There can be multiple instances of Docker containers for the same Docker image.

Containers share the OS kernel with each other.

On stopping a container, all the changes made are lost.

Show image:

Docker Process Flowchart

This flowchart shows the process of downloading and running the mongodb image.

The image will be downloaded from Docker Hub.

Show Slide:

Docker Process Flowchart

Hover over Docker Hub block

Docker Hub is an online Docker image registry.

An image registry is a storage location for Docker images.

It allows the pull and push of images.

Show Slide:

Docker Process Flowchart

Hove over Docker Official Images block

Docker Official images are a curated set of Docker repositories on Docker Hub.

Some of the official images are python, nodejs and mongo.

Show Slide:

Docker Process Flowchart

Hove over mongo block

In this tutorial, we will pull the mongo official image.

We shall then run it to create a local mongodb database and connect to it.

Show Slide:

Docker Process Flowchart

Hove over Docker Container block

Using the run command we will create a container for the image.
Show Slide:

Docker Process Flowchart

Hove over Port Mapping block

We map port 27017 of the container to port 27017 on our system.

This allows us to access the application from our system.

Only narration Now we shall implement this process on our system.
Open a terminal by pressing the keys Ctrl, Alt and T simultaneously.

Type the command sudo space docker space pull space mongo in the terminal.

Press Enter. Enter your password if prompted.

The image will start downloading.

This step may take some time.

Please wait for the download to complete.

Show slide:

Run Command

In order to run the downloaded image, we will use the Docker run command.

This is the syntax for the run command.

The run command creates a new container for the image specified.

Additional flags can be provided to set parameters.

These parameters can be container name, ports, mode of operation etc.

If no name is specified, a random name is assigned.

Switch to the terminal window. To run the mongo image, type the command as shown.

mongo_commands.txt code file has the commands used in this tutorial.

You may copy and paste these commands in the terminal instead of typing.

Remember to Press the Enter key after each command in the terminal.

Highlight --name mongodb-container To set the name of the container, we use the hyphen hyphen name flag.

Here we set the name of the container to mongodb hyphen container.

Highlight We can set environment variables for the application using the hyphen e flag.

Here we set the root user variable.

It is MONGO underscore INITDB underscore ROOT underscore USERNAME.

The value is mongouser.

Highlight Then we set the MONGO underscore INITDB underscore ROOT underscore PASSWORD variable.

This variable sets the root user password.

The root user password here is mongopwd.

We will use this password later when we connect to the mongodb database.

Highlight -p 127.0.0.1:27017:27017 Next, we need to bind the host port to the container port using the hyphen p flag.

Port binding is required to access the container application from our local system.

The host port is specified first, followed by a colon, and then the container port.

Here, the host port is 27017 and the container port is 27017.

127 dot 0 dot 0 dot 1 refers to the local host.

We map port 27017 of the container to port 27017 on our system.

This means that the mongodb database will be accessible on port 27017 on our system.

Highlight -d Then we use the hyphen d flag to run the container in detached mode.

Detached mode allows the container to run in the background.

Highlight mongo

Press Enter

Finally, we will specify the name of the image to be run.

The name of the image is mongo.

Press Enter to execute the command.

Highlight the output of the command. On executing the run command, we get the id of the container as the output.
Type sudo docker ps In order to view the running containers, we use the ps command.

Type sudo space docker space ps

Press Enter.

Enter the password if prompted

Highlight the container id of the container mongodb-container. You can see the details of the container we created earlier.

It shows the container id, image, command, status, ports and the name.

The mongodb database is now running.

Type Now let us connect to this database using exec command.

Type the command as shown.

Highlight mongo-container Here the mongodb hyphen container is the Docker container running the mongodb database.
Highlight mongosh Mongosh is the command that we are executing.

Mongosh is a shell for interacting with the mongodb database.

Highlight Then we specify the username and password.

These were previously set in the run command.

Press Enter. Press Enter.
Highlight test> You will be connected to the test database.
Type show dbs; and press Enter. Type show space dbs semicolon and press Enter.

You can see the available databases now.

These are admin, config and local.

Type Ctrl + D keys simultaneously. To exit the shell, press Ctrl and D keys simultaneously.
In order to stop the mongodb container, we use the stop command.

Type sudo space docker space stop space mongodb hyphen container.

Here mongodb hyphen container is the name of the container.

Press Enter.

Type sudo docker ps -a and press Enter. To verify that the container has been stopped, use the ps command.

Type sudo space docker space ps space hyphen a.

The hyphen a flag allows us to view all the containers on our system.

This includes stopped containers.

Press Enter.

Highlight the output. The status exited denotes that the container has been stopped.
Only narration. In order to remove a container, we use the rm command.
Type the command sudo docker rm mongodb-container

Highlight mongodb-container.

Press Enter.

Type the command as shown here.

The rm command is followed by the name of the container.

Press Enter to execute the command.

Type the command sudo docker ps -a and press Enter. Now type sudo space docker space ps space hyphen a.

Press Enter.

The container should be deleted and not be listed.

Show Slide:

Summary

This brings us to the end of this tutorial. Let us summarise.

In this tutorial, we have learnt about

  • Images and containers
  • Pulling an image from Docker Hub
  • Running an image
  • Accessing the running application
  • Viewing running containers
  • Stopping and starting a container
Show Slide: As an assignment, please do the following:
  • Pull the official image of Python from Docker Hub
  • Run the image with the -it flag to run in interactive mode.
  • Check the version of Python when the image is run
  • Check the version of Python in your local machine using command python3 –version
Show slide: The version of Python on my system is 3 point 10 point 12.

This version may be different for you.

Show slide: On executing the run command with the hyphen it flag, the Python shell will open.

We can run Python commands in this shell.

The version of Python is displayed when the shell is opened.

The version of Python in Docker image is 3 point 12 point 3.

This version may be different for you.

Show Slide: About Spoken Tutorial project The video at the following link summarises the Spoken Tutorial project.

Please download and watch it

Show Slide: Spoken Tutorial Workshops The Spoken Tutorial Project team conducts workshops and gives certificates.

For more details, please write to us.

Show Slide:

Answers for THIS Spoken Tutorial

Please post your timed queries in this forum.
Show Slide: FOSSEE Forum For any general or technical questions on Docker, visit the FOSSEE forum and post your question.
Slide: Acknowledgement Spoken Tutorial Project was established by the Ministry of Education, Government of India
Show slide:

Thank You

This is Karthik Chandrasekhar, a FOSSEE Semester Long Intern 2024, IIT Bombay signing off.

Thanks for joining.

Contributors and Content Editors

Madhurig, Nirmala Venkat