Hey, beautiful people, and welcome to the lecture.
We are going to discuss everything about container's running containers in the Linux environment.
So first things first, what is a container?
The term container and the concept behind it came from the shipping container.
Yes.
If you look at this picture right away, this is a physical container which holds all the different
type of cargo shipment and it actually can be transported to everywhere in the world.
So these containers are shipped from city to city and country to country, no matter which part of the
world you go to.
You will find these exact same containers with the exact same size or measurement.
You know why they are built with the exact same measurement?
Because around the world, all the docking ports, ships, trucks, warehouses are all of them built
to easily transport and store them so they don't have to buy different trucks.
They don't have to buy different lifts that will lift them up to store them.
So everywhere you go in the world, it's exact same size and that's what makes the transportation a
lot easier.
So that's visualize it.
So you take that container and you put it in a truck and then that truck goes to the docking station,
put that onto the ship.
Then what happens is this ship has to be transported from one end of the world to another.
And and then on the other side of the world, it actually picks the lifts that container and actually
put it on the truck, which can hold the similar same measurement size of that container.
And it has ships over.
All right.
So that's what it was about in a very basic or layman's term, how the container came from.
Now, let's look at the container in IT world now.
When we're talking about containers in it, we are fulfilling somewhat similar purpose in all day.
So there was a developer, she would write a code in her laptop.
And while she's writing a code, the whole purpose of writing the code is to she create an application.
So once the code is written, the application is bill.
She tested it on on her laptop.
Then she copies that same code or that same software to a production server.
Then the production server will open up that package or install the package.
Then we will try to run it and somehow it won't run.
Then what will happen is the developer will come back or the program will come back and says, hey,
it runs on my computer perfectly, but it doesn't run on the production.
That's why the main reason these containers were born.
So then came the containers technology, which allowed a developers or programmers to test and build
applications on any computer just by putting it in a container, the container is built.
And within the software, the software code, libraries and configuration files, and then run on any
computer, regardless of its architecture, it doesn't have to come or ship what the operating system.
So you can move that application within that container anywhere without moving its operating system,
which is just like moving the actual physical container, which will disgust anywhere that will fit
on any dockyard, truck, ship or warehouse.
So an operating system can run a single or multiple containers at the same time.
To summarize, again, I'm sure this these two slides have made it a lot clear what a container is.
It is just a combination of your source software code, libraries and configuration file and no operating
system.
You could move that container anywhere from one machine to another and it will run flawlessly.
OK, here is a note that you need to understand.
Container technology is mostly used by developers or programmers who write code to build applications.
Now, you, as a system administrator, your job is to install, configure and manage them.
Your job is not to write a code and package it together and and create an application out of it.
All right.
Moving on, what are the container software?
So let's talk about what are the software that are available that actually manages these containers
in the very first one in the line is the docker.
I am sure you have heard of Docker many times.
And again, this Docker concept came from the same way as a container.
The container where you actually land these containers are the docker yard.
So they got the name Docker from the same dockyard.
So Docker was developed by Solomon Hikes in the March 20th, 2000 13th.
Docker is a software used to create and manage containers.
Just like any other package Docker can be installed on your Linux system and its service are deman can
be controlled through native Linux service management tool.
By the way, Docker is not only specific to Linux.
There are other versions of Docker that can be installed on Windows to to provide the same container
technology.
All right.
Then comes in Pod Man, which is the focal point for us and for this entire lecture or the rest of this
lecture pod man was developed by RedHat and it was release.
The first release was sometime in August 2018.
The pod man was developed as an alternative to.
Now, why they made it and why didn't they like the docker?
I cannot answer that.
But anyway, for those who are using Red Hat Linux, you should know that Docker is not supported in
Red Hat Enterprise Linux eight.
So you would have to go to with Pod man.
OK, it is a demon less open source.
The Linux native tool designed to develop, manage and run containers, of course, just like Docker,
but it is RedHat own developed software to actually run containers.
There are many other containers, applications, engines and softwares are out there.
But I am only covering docker and pod man.
If you want to learn more, what are the other soffer?
Feel free to search it online.
All right.
Moving on, getting familiar with the Red Hat container technology.
Now we are getting into the actual red hat.
Now we are moving away from Docker, so now we are focusing on Padman.
So what are the Red Hat container technology?
Readhead provides a set of command line tools that can operate without a container ingen.
These include a pod man for directly managing pods and containers, images, for example, running,
stopping starting point, which is checking the status, attaching the containers, etc..
You use this utility call pod man.
Then you have another one called Belder for building, pushing and signing container images.
Then you have Scorpio for copying, inspecting, deleting and signing images.
Runcie for providing container run and build features to partment and build up.
And the last one is run and optional runtime that can be configured and give greater flexibility control.
And so.
For rootless containers, roulette containers are the containers where you do not have to be ruled in
order to create or run these containers anyway.
From this point on, our focus is only going to be on the pod man, which will be used to to basically
create and manage the containers.
All right.
Now, next thing is getting familiar with pod man container technologies.
So when you hear about containers, then you should know the following terms as well.
The first one is images.
Containers can be created through images or from images, and containers can be converted to images
as well.
Just like for those who who understand the term template in virtualization environment, you could create
a virtual machine from template or you could actually convert a virtual machine to a template.
The images works as same as those templates.
Then the next one, pods.
Pods are the group of containers deployed together on the host or on an operating system in Pod Men
logo.
There are three seals grouped together, has a pod.
You see this logo?
That's the logo and these three seals that represents the group of containers running at the same time.
All right, now let's get into building a running and managing containers.
Let's get our hands dirty and run our create containers.
All right.
The very first thing we have to do is to install pod man again.
Man is a command line tool that allows you to create or manage your containers.
The first command you have to do is Jume or DNF to install a package.
So you will have to do DNF install pod man and minus Y option to to say yes to all the questions that
will be asked during installation.
If you are doing a darker install, you could do the same way youm install Docker with minus Y option
and that is only Protarchus.
So I am what I'm going to do is I'm going to start up my computer.
But runs, of course, the Linux machine I have read had eight and I also have Santos seven, so we
will run both of them at the same time.
And some of the commands, Alcoa and RedHat, eight, and some of them, Alcoa and Santos seven.
All right.
So let me start let me go to my Oracle voicebox.
This is where this is where my virtual machines are running.
This one, my first Linux VM is my RedHat eight and this is seven, which is running S.O.S seven.
So very first thing I want you to do before you even power it on or start up, I want you to take a
snapshot.
So right here it is already on the snapshot menu and click take and you can name it before.
Containers.
So in case you wanted to revert back, something goes wrong while you're downloading, you can always
report back click OK.
Same thing with seven click snapshot take.
Therefore, container's.
OK, perfect.
Now, let's go ahead and start both of these machines.
This is eight and this is seven.
I'm covering both eight and seven.
So those who are practicing Linux or Linux containers on seven, they would be able to understand how
these commands are similar and can be can be run on both operating system versions.
OK, so I have my red hat right here and I have my CENTAVOS seven right here, so I'm going to leave
them.
Right next to each other side by side, first we will run the install command on RedHat eight and I
will use the command DNF install.
Pod man with minus Y option, so it could answer yes to all the questions during the installation.
Similarly will run same command except replace DNF with the GM install pod man minus Y.
OK, so depending on how slow or fast your computer is, it could take anywhere from a minute to five
minutes.
All right, on RedHat eight, the download and installation of Pod Man has been completed on Sentosa
seven, it is almost there running transaction check updating and it should be done in any minute anyway.
While we are waiting for that, let's go ahead and run the next command, which is to create aliased
to Docker.
Now, this command is only for those who have a docker running on the Linux machine and now they wanted
to use pod man so you could simply create an alias for you doctor to pod man.
So which will still run all the commands a docker, but it will run through pod man.
So we will leave that as is because we never had DOCA running before.
The next command is check pod man version.
So the pod man that we have installed, let's check his version by running the command pod.
Man Minus we the version is Pod Men Version 3.0 to let's check the other machine is still updating.
Let it run.
The next thing is.
Getting help, so if you need any help regarding pod man, what options would commence to use, you
could use either pod man dash dash help or simply go to the manual pages are pod men.
So if you let's clear the screen.
If you type pod man, dash, dash, help and hit enter, you will get all these different options.
And if you scroll up you will see all these optional commands that are available with the command pod
men.
You can attach or attach, build it, commit a copy, create def, export all these commands or options
that are available that your pod man command.
You could also check all the options that have available to you by running the command man pod man,
it's just a regular man page hit Enter.
And here you will see it will give you all the documentation about pod men, simple management tool
for pods, containers and images, as you scroll down by hitting the space bar key, you will find all
the different options that is available under Pod man.
Let's go check on a sent us machine.
That's where the installation has been completed.
Beautiful.
Now we will run the same command here.
Pod man minus V to check the version.
This one gives us a different version because it is running on a different operating system version.
That's fine.
Same way pod man.
A dash dash help gave you all the help that you need.
You can also do man pod man and you will get the manual page just like as we do on seven or sorry on
eight.
Then moving down to new other commands.
Check Pod padman environment and its your repository information.
So when you run pod men info, so if you are trying to load a container image then it will look at the
local machine, then go to each registry by the order listed.
Now what are those listed registry.
Let's take a look as do Pod Man Infl.
And here you could just scroll up a little and you right here where you see registry's search, if you
want to search for a specific image, it will go to its local machine to see if it has any images that
you're looking for.
If you if it can't find it, then it will go to registry dot access, dot red dot com.
Then it will jump to registry dot red dot io.
And then last it will go to Dakotah Io wherever it could find the image that you are looking for.
So here the same way, let's clear the screen pod man and po and same information will be given to you
right here.
Registry three different locations where you could get your images.
All right.
Then the next command to search a specific image in repository.
So let's say you build a machine.
You already have a pod man.
The tools that you need.
Now it's time for you to run a container.
But before you run a container, you don't have to go in and build a container.
There are pre-built containers out there and those are packed together in something called an image.
So we have to look for the container image.
So in this example, we will look for EPD image.
So let's come down, clear the screen and do pod man.
Hey, pod man.
Search for a sorry not contain a search search for an image called.
And again, it will go to all those repositories, registries that we looked at when we ran pod man
info and it will pull the information.
So right here it pulled all the information about images there where you can find the EPD.
Now let's go up.
And right here, when we ran the command, here is the title of this table, the first one tells you
this is the index, this is the name description.
These are the stars, the stars the actual user had given to this image.
Is it official?
Is it automated?
All the information is there.
So as you come down, you'll see there are zero stars.
Probably never nobody has used it.
We will go down and look for the stars that has the highest stars.
So, for example, right here, this is darker.
I know the image that you're looking for is can be found in crawdaddy or slash library slash HPD and
it has 36, 16 stars.
So right now at this time, while I'm recording this video, it is showing 36, 16.
Maybe by the time when you run this command, you will have a different number anyway.
So we know that this one is definitely a lot of people have checked it out.
They have downloaded this image.
So we will use this same image or same location to download the image.
All right.
For that, what do you have to do?
So let's go to the next screen and here to list any previously downloaded pod meant pod man images.
So before we pull this image down, we let's check if I already have any images running on my system.
I'm sure there isn't because I never had pod men before.
So just to show you the command to check is pod man images and it is telling you the title of the image,
the tag, the image.
But there isn't any information underneath.
It means there aren't any images available.
Similarly, in Santos seven pod man images and nothing will be found perfect.
Now, moving on now, we already verified we don't have any images.
So what's the next step?
Next step is to download the available image and that available image can be downloaded.
We'll look for HTP and we know that image is available on this registry.
So to download that, you have to choose the command pod man with the pole.
Since we are pulling it down, let's clear the screen and do pod man.
Pull from where?
From Docker whio slash library.
By the way, this you are all that I'm putting it down or this a registry information I'm putting down.
I got this information when I ran department info with the stars, remember.
Thirty six.
Sixteen.
That's exactly what it is.
It enter, it will go to their registry and pull the available image that's already sitting here on
this you url and it pull it down same way here in the screen pod man pull darker io slash library and
it's going to pull it down.
OK, by the way, up until this point you guys have seen and and confirmed a few times that all the
commands that I'm running on eight are pretty much working the same way on seven.
So what I'm going to do from this point on, I'm just simply going to minimize seven and all the commands
that I'm going to run.
After this point, will, I will be running on eight.
So it doesn't matter if you have only seven, you could just follow along.
All right.
So the pod man pull docker image has been downloaded.
How do we confirm it has been downloaded?
You can run the same command pod man images.
And right now this is telling you, hey, I got this image, this is the image ID and the repository
came down.
This is the repository is Tagore's letus.
It was created fifty one minutes ago.
Wow.
Someone has modified and then the size of this is a hundred and forty two megabyte.
All right, beautiful.
All right, so we already checked the images, images have been downloaded next command to list pod
men running containers.
So we have the image and now we need to run the container.
But of course, before we run it, let's check if we have any existing containers running.
Of course we don't.
But we still wanted to check because I want to learn the command, how to check the existing running
containers.
And for that you have to run pod man piesse.
Again, just like padman images, we have the title line up here, but we do not have any other information
about the containers telling me the container ID image command, create a status port, MS.
But there is an actual container.
So we have confirmed nothing is running now.
What's the next thing now?
We have to run the container, OK, to run a downloaded HTP container, which we just downloaded.
This is the command we have to run.
Let's clear the screen pod man run.
And by the way, let me just quickly go back and tell you more about these options D for detach, meaning
I want my terminal back T for terminal.
Why should my prompt shell and P minus option P is for the port that I'm specifying for this HTP container.
And then of course we run pod maps to check if that container is running.
Our pod man running minus D, t minus people poured eight zero eight zero, Kolan eight pathetically
sorry, eighty four TCP and then where is the registry darker io slash library slash htp d.
Now, how do we check if we have our containers successfully running?
Good question for that.
You have to do pod man.
Yes.
And here it is, your container I.D..
The image where it actually downloaded the image from the command created 19 seconds ago, that's when
I ran this command status up 18 seconds ago.
And this is the port, the IP, which is a local host.
This is the port that you specify for HTP, the TCP and AD.
This is loving Wilson, who were actually named at this image to whatever they wanted to give.
So you could give it any name as well.
If you want, you could give when you create a container out of image, you could give it any name you
like, which will cover in a second.
All right, beautiful.
So we have confirmed that the container is running.
There is another way you could confirm whether the container is running by going to your Firefox.
And type localhost.
Colon eighty eighty localhost is the IP address of my machine.
I could have used it.
Zero zero zero zero, that's fine.
And the Port 880.
Remember the Port 88 eighty specified for this HTP hit enter.
And right here I got the page that says it works.
Brilliant.
So if you are here and you follow me here exactly up to this point, it means you got your container,
your very first container running the congratulations.
All right, let's close this.
We have confirmed that it is up and running, so let's close this down now.
Next thing, what we need to learn is to view pod man logs, anything that we wanted to learn.
Its pod man is not running the container successfully.
You could definitely check the logs.
Pod man logs a cell and it will tell you all the information that you need as to when it started, how
is it working and all the information that you need to troubleshoot further.
Let's clear the screen.
Let's go to the next slide to learn more about building, running and managing containers.
Now to stop a running container, you could just simply do pod man stop and a container name or container
I.D..
So how do we know what is the container name or ID for that?
You could just simply run pod maps, which give you the status of your container.
And the container ID is right here, which is the very in the very first column.
If you want to stop this container, all you have to do is pod man stop and this container id you could
just right.
Click copy and come back here.
Right.
Click and paste and enter and it should stop by giving you your prompt back.
How do you confirm it actually has stopped.
If you have answered pod maps then you are absolutely right.
There you go.
You just ran it and now you don't see any container running.
Awesome.
OK, moving on, we check the pod maps.
OK, now to run multiple containers for DPD by changing the port.
No.
What if you wanted to run two containers out of the same image, you could run the same command, but
you have to specify a different port.
So just like that is.
Yeah, I'm picking eighty, eighty one and in the second one I'm picking eighty, eighty two.
So let's clear the screen.
I'm going to bring back my previous command by hitting the up arrow key, which will bring me the command
that I ran to start or to run the container.
So I'm going to do eighty one.
And Toure, this has started and I'm going to do 80, 82, so now this is going to start to containers
out of that one image.
And how do we check if I have to contain a running pod man?
And here you have one container right here.
And this is the second container right here.
This is on Port 81 and this is on port eighty, eighty two.
Now, if you go back to your Firefox and specify localhost eighty, eighty one and another on another
tab, you specify 80, 82, you will get a similar result.
All right.
We check the pod man status now to stop and start a previously running container.
You could just simply do a stop, which we already covered.
You could stop it and you could stop it as well.
So just to cover this piece, we could just simply stop one container so we could stop 80, 82.
So pod man stop and the container ID copy and.
Based enter, it should stop, how can you confirm pod maps and only one container is running at this
time now?
All right, moving on to create a new container from the downloaded image.
OK, so pay close attention.
When we downloaded the image earlier, we actually ran that container straight out of the box.
Now, what if you wanted to download, make certain changes to that image to way that you wanted to
look or function or maybe instead of it works, you wanted to put your name Imron ARV's or something
like that, then you have to change its code and then create another new image out of that.
OK, so for that, what do you have to do?
Let's clear the screen.
What you have to do is you have to type pod man create dash dash name.
Now what name do you want to give it to here.
I have given to Dipti you could give your name as well just for fun of it.
But any anyway to be consistent will use.
It doesn't have to be.
It could be anything.
Now, where is the registry registry is darker, that is library slash HD.
All right, it has created the container.
Now, how do you check the container?
We do pod man so it is running only one container, which is cursing Lisco, not HTP.
So that means it actually created the image out of that pod man container and created the container.
Now, how do I start that container that I just created out of that image?
This one for that you simply have to do Pod Man Start and the container name, which is HTP.
There you go.
It has started.
Beautiful.
Now you should have two containers running.
One container is the container.
You got it running right out of that package that sorry, that image.
And this is the second container that you're running that you created yourself.
Beautiful.
Now to start the newly created container, you do start HP, we are one step ahead.
We already did that.
Beautiful.
Now what is next?
Now next step is what if you want to manage your containers, meaning when your computer boots up?
What if you want your computer to boot up that HTP container?
Would the system.
So, of course, as you know that to boot or to control any bood processes that is managed by a process
called system.
So we have to notify systemd process.
Hey, there is this new process that you have to run every time this system builds up.
So for the very first thing you have to do is to first you have to generate a unit file a unified can
be generated with the pod man.
Why do we need a unit file?
Because if you come down, there is this directory called ETSI System Deed System.
You have to put that file which called unified into this directory in order for D to know, hey, there
is this new service, it has to start.
So let's clear the screen.
Let's go to ETSI System D system and when I do X minus Altura, less mysel, whatever you want to do,
you see all these targets, all these services have been defined in this directory to be started during
boom time.
So I had to create this the service file, which is called Unit and I have to copy that into this directory.
Very simple for that.
What do you have to do is we have to run the command pod man, because pod man will generate that unit
for us, generate system D, dash, dash, new dash, dash, file, dash, dash name and what name do
you want to give?
This will be the name that you have given to your container.
If you had given in the previous command when we created the container from from the image using the
command pod men create and be given the name you have to use that same exact name hit Enter.
And right here it is telling you the container ATSE system, the system container, it's there.
It's already been copied over, which I did previously.
If you do not get this message, you're most likely you will get the message that it is in slash rude
slash root directory.
I mean, you do this myself here, it will tell you, hey, it is in this directory anyway.
If it's if you don't get it then it means it's already in there.
So let's go to ETSI System D slash system to S minus L tr and right here at the bottom you see it has
created the unit for our HTP container.
Beautiful, beautiful.
OK then what do we have to do now.
Enable the service because we want this service to start a boot so we have to enable it.
So system ctrl enable container.
HPD service, it has it has it is creating this symbolic link perfect, what's the next step now?
If you remember, you have to start the service to start a service.
You have to do System CTL, start the container unit, file it, enter.
If you don't get an error, it means your service has been started.
Now, how do you check the status of that service?
You could just simply do status and you will see right here, it is active and it is up and running.
Excellent.
So we learned so much in this container video.
You should know what a container is now.
How do you build it on it and manage it in the next environment?
Good luck.