So, so far we talked about running standard container images.
Sometimes you just want to build your own.
And that is where you are going to use a container file.
A container file, previously known as Docker file, is a text file with instructions to
build a container image.
And container files have instructions to build a custom container based on a base image, such
as the UBI image or the BusyBox image, or whichever you want to use.
UBI is an important one in a RHEL context.
I repeat what I said before, it's a universal base image, and that's an image that Red Hat
uses for all of its products that are based on RHEL software.
Let me show you.
In order to run this demo, you need access to the Git repository.
And I had it in the root user home directory, not here, so let me just Git clone it again.
Not very efficient, but it will do.
Now I'm going to use Potman Info.
And why am I going to use Potman Info?
Because it's a convenient command that is showing, for instance, search registries.
And that is kind of useful.
You can see where it checks for container images if you are using an unqualified name.
And if you scroll up, you can see so much more information about your containerized environment.
So do have a look at it.
Now I'm going into this RHSA 10 Git repository.
And before I'm continuing, I'm using Potman images so that you can see images currently existing.
And next, if it's still needed, Potman login registry.access.redhat.com.
Well, I think we already did that, so I can skip that.
So we can move to the next command.
And in this next command, we are going to use ContainerFile.
So what do we have in ContainerFile?
This is a very simple ContainerFile.
It is using from, which specifies the base container image that I want to use.
So registry.access.redhat.com slash ubih slash ubi.
That's the idea if you want to containerize your own application.
You are just going to use one of these system applications.
And ubi is one of them.
Then run is a command that is used while building your customized image.
And I need to run dnfinstall vim enhanced.
Minus y, because when you run a ContainerFile, it's not going to prompt for anything.
It shouldn't.
And that is why I'm using the minus y to give dnfinstall a yes.
So that's not going to ask for confirmation.
And thirdly, we have the cmd.
That is where you specify your command.
The command is specified as an array.
And that means that all the different elements of a command
are between double quotes and comma separated,
written the way you can see it right here,
and also between square brackets.
And just make sure that you use a full path name of your command,
because after all, a container image is a minimized environment.
So this is a very minimal Dockerfile.
You don't have to know how to build fancy Dockerfiles for your RHCSA exam.
You do need to know that you can use potman build to build them.
So I'm using potman build minus t sleeper dot, which is doing what?
It's going to use potman build.
That is what you use to process the ContainerFile.
And the minus t stands for tag.
And the tag is really a name.
So I'm going to build an image with the name sleeper.
And there we can see step one out of three,
and we can follow all the different steps
that it's using to build the ContainerImageFile.
Almost.
So as you can see, a lot of stuff has happened.
And in step three, we can see it added to the command,
use bin sleep.
So potman images is giving me what?
Well, that is giving me that there is a localhost sleeper.
And I can run it.
So potman run localhost slash sleeper to avoid any confusion.
And then rest well for the next 30 seconds.
So now it is done.
I just built my own ContainerImage.