- So in this video I will tell you about container images.
The purpose of a container is to start an application.
And a container image contains
all of the dependencies that are required
to start that application.
Existing container images can be used to run containers,
and images are provided through public
as well as private image registries.
Docker Hub, accessible at hub.docker.com,
is the biggest public registry
and the most commonly used registry as well.
Let's check out Docker Hub before continuing.
So this is hub.docker.com.
You can create an account
which offers a couple of benefits.
If you are looking for a specific image
you can also search for the image right here.
So let's look for nginx, for instance.
And what do we see? We see verified content.
Verified content are reliable images
which has been verified
and there is normally some company behind.
There's also community images.
And the community images, well, if you see 10,000,
that means 10,000 or more.
Let's have a look at the verified content.
So here we can see the Docker image,
including the command to fetch the image
and a quick reference.
So normally the image has some documentation
associated to it as well.
And in some cases, this documentation is really very useful.
Here you can see that the documentation is very detailed
and is really helpful in running the nginx container,
that's not always the case.
If you're ever looking for images,
have a look at the Docker website.
It's the best way to find your images
and much more convenient than a command line.
So while running containers, the required images
are fetched automatically and stored locally.
And to find images you can use the search features
on the image registry
or the docker or podman search command.
And to fetch an image, you can either run the container,
which will automatically fetch it,
or use docker or podman pull to pull the image
without running it as a container.
After pulling some images
you can use docker or podman images
which will show images currently installed
and available for the current user.
Let me show you.
So for this podman demo I'm going to leave my root shell
because we don't need root privileges to run containers.
And running containers from a root shell
is not the best practice that's available.
Now this is centos and on centos
podman is installed by default,
that makes it very easy.
So if I use podman search nginx
then it's going to search in the default registries
and it is showing all the registries
where it has found the image.
Now, in podman, multiple registries are pre-configured.
If you are using Docker,
docker is by default going to the Docker Hub
and you will just see the image name.
Now what we see here is the nginx image
that we have just seen in the webpage as well,
and if I want to fetch it, well, I can use podman pull.
Now, podman pull can be fo followed by a short image name
but the nicer way of doing it
is the fully qualified image name,
so podman pull docker.io/library/nginx.
Why the fully qualified image name?
Well, because there's more than just the Docker registry
and this allows you to identify
exactly which image you want to use.
Here we can see the image being pulled,
the multiple layers of the image.
That's because this nginx is probably based on some
other container images that are managed by somebody else,
and all of these layers are managed independently.
Now, I can use my podman images command
and the podman images command is showing
the image available on the system
with the size of 146 megabytes.
There's no real needs to do podman pull
before actually you're running your container,
but I wanted to show you
a little bit about managing images.
Now that you know how to work with images
let's learn about learning containers.