All right.
Let me show you how to create your own image mode image.
There's a couple of things that you need to do on beforehand.
You need to make sure that the repository server is
available at the host computer.
All went well.
You have done it in the lab of the last lesson.
If not, make sure that you do set up this repository
server.
Without it, it won't work.
Next, you create an ETC host file that resolves registry.example.com
to the IP address of the same host computer.
And you need to make sure there is a registry with the name
registry.example.com, which is defined in ETC container
registries.conf.d with the following contents.
So in this contents, we have location.
It's registry.example.com.
Insecure is true, making sure that it's not
going to use TLS, but without.
And blocked is false to make sure that nothing
is going to be blocked.
Before continuing, let me show you how to set this up.
OK, so let me start with the ETC hosts.
I need to resolve to IP address 142.
So Vim on ETC hosts is giving me what?
Well, 192.168.29.142.
And that is registry.example.com.
Let me also remove the other line,
which really we don't need.
That was a demo in a previous video.
So that is one part.
Then I need to make sure that we have this entry in the file
in ETC container registries.conf.d.
So let me go into ETC containers, registries.conf.d.
And let me call it registry.conf.
Oops, I wanted to change directory
and create it from there.
So registry.conf, we already have a registry.conf.
Now we can work on that.
This is not what I need.
I don't want to be working on local host.
I want to be working on registry.example.com.
And insecure is set to true.
And blocked is set to false.
And that should be it.
So now we can talk about creating installable images.
So how does it work?
Well, the bootable images are created from a container file.
Notice that in a current directory,
that is where your container file is,
you must have an ETC directory with at least the repo file
for the repositories, as well as the ETC host file
that you've just created.
And then this is the content of the container file,
where the from line is giving the base image
that you want to use.
Add is adding the ETC directory.
Run is going to install the HTTPD process.
And the second run is going to enable it.
And then finally, we have an index.html,
which you also need to create,
which is copied to var www.htmlindex.html.
Let me show you.
All right, so I need to start by creating a product directory.
Let's call it image mode.
And then I go into the image mode directory.
And I need to create the ETC directory.
Doesn't exist yet, so mkdir etc.
So next, I need to copy my ETC host into this ETC directory.
And also, the etc yum.repos.d,
repo underscore for the base OS,
and repo underscore A for the app screen.
Let's do a quick check.
And oops, this is almost all right.
mkdir yum.repos.d.
The repository files need to be in the right directory.
And that is not directly in the ETC directory,
but one level down.
So now I've taken care of my ETC directory.
We need an index.html.
And that will be welcome from the image mode.
And now I can create the container file.
So in the container file, we are using from registry.redhat.io
slash rel 10 slash rel bootsy colon latest.
Then I'm using add ETC to ETC, which
is adding everything from the local host
ETC to the resulting container ETC.
Just to be consistent, I use a tab.
And I like consistency, so I'm making it a space.
Then I'm using a run dnf minus y in sol, httpd,
as well as mod ssl.
Don't really need that, but it doesn't really hurt.
And dnf clean all to clean up all the dnf cache.
And then run systemctl enable httpd.
And finally, copy dot slash index dot html
to var www.htmlindex.html.
And that creates the container file.
Good.
Let's get back to the slides.
So now we need to build the bootsy image using
Popman build. Then we do need to make sure
that the registry is available at registry.example.com.
Well, we already did that.
And then I need Popman push.
After doing the Popman push, we can run the image locally.
In Popman first, because you want
to make sure that it runs as an ordinary container
before you are going to put it into image mode.
Feel free to use Popman exec to execute into the container
to explore the contents of the image
to verify that everything is all right.
Now let me show you.
OK, so first, Popman build minus t.
I need to tag it.
And in the tag, we need to use the name of the registry
where it is going to end.
So that is registry.example.com colon 5000,
which is my local host registry, which I'm just
making accessible through another name.
That's why we modified the ETC host cell.
And dot for doing it on the local directory.
This might take a minute.
And oops, small typo, mod sll.
That doesn't work.
We need to make that mod ssl.
And try it again.
All right, so far so good.
So now that I've created the image,
I can use Popman push to registry.example.com
boot image latest.
And there you can see that the image is being pushed
to the local registry server.
OK, now that it's available on the local registry server,
I can use Popman run minus d minus p 8080 colon 80
of registry.example.com colon 5000 slash boot image.
Just to give it a try.
And then I should be able to curl localhost colon 8080.
And there we get welcome from the image mode, which
means that the image mode image has successfully been created.
And we are ready for the next step.