Hello, and welcome to this video on how to use Podman with a public registry.
The plan today is to outline what a container registry is and then to walk through using
a public registry - in this instance we will be using the Oracle Container-Registry instead
of Docker Hub.
So without further ado, let's get started by briefly outlining what a container registry
is...
A registry is a central location for hosting and distributing different container images.
A repository, on the other hand, is collection of the same container images that have different
'tags'
There are two types of registry - public and private.
Public registries are very accessible to anyone, usually cloud-based and offer little, or no
security features (to control access, etc), but in return host a wide range of different
containers.
Private registries only host those Containers needed for their business applications, and
are usually configured to meet the an organisation's internal security requirements and enforce
these security and privacy measures on the images used in their applications.
Private registries can be hosted either in the Cloud, or 'air-gapped' - meaning no external
connectivity - on physical hardware located on a business' premises.
You may be wondering which is better?
Well, both have their uses. Most companies source their 'base' images from a public registry,
and then host their own applications, based upon those originals, on a private - internally-hosted
- registry.
Thereby ensuring both privacy and security for their own deployed applications.
If you want to know how to pull an image, and use it, within Podman please refer to
a previous video called "Pulling an image using Podman on Oracle Linux 8"
For now, this video will describe a change that has occurred since that was produced.
Namely that the configuration file now returns containers from both the public Oracle Registry
as well as from Docker Hub, as I will show you shortly.
So let's quickly login in to our instance take a look at the Configuration file and
then how to pull an Oracle image from the Oracle registry.
First of all we an open terminal session to our instance.
For reference this instance is a minimal install of Oracle Linux 8 which has been fully updated
and then the Oracle Linux module providing container tools (container-tools-ol8) installed.
So, before we download anything let's take a look at where the configuration file Podman
uses to know where to look are located.
So open a command prompt and enter: 'ls /etc/containers', this will list several files, one of which
is called 'registries.conf'
If we take a look at that file, amongst other things it will define the registries that
will be used by Podman when a 'podman search' command is issued.
To look at our configuration use your favourite editor to look at it - I'll use Vi like so:
'vi /etc/containers/registries.conf'
Now scroll down a short way until you encounter a line starting with "unqualified-search-registries
='
Notice how it refers to a couple of locations - ["container-registry.oracle.com", 'docker.io"]
This means it will return any information it finds from a search of both registries.
So now we know where Podman will look, let's take a look at how that information is returned
to us by asking Podman to search for a container using a public registry then to retrieve,
and use, that container.
Instead of looking for the traditional 'Hello World' application, which does exist on every
public registry, we will instead look for a minimal version of Oracle Linux 8 (because
I know it's there).
Remaining on the same command prompt, let's ask Podman to search through the standard
registry locations that are defined when it ships, by issuing a search command...
Type 'podman search oraclelinux | head -n 10' to initiate the search and return the
first 10 results.
If you look at the the uppermost lines it should be possible to see a reference to the
Oracle hosted public registry...
As mentioned earlier, a previous video ('Pulling an image using Podman on Oracle Linux 8')
outlined how to use use Skopeo to retrieve information about the tags available; please
refer to that if you prefer to remain wholly on the command-line.
There is an alternative method available to locate the tags available, for that we will
need to open a browser and navigate to https://container-registry.oracle.com
Which will list the different categories of Oracle software that is hosted here.
Scroll down, and click on the link called 'OS' (which also has the Linux Penguin)
This will now show you two options: 'oraclelinux' or 'registry'
Click on the the 'oraclelinux' hyper-link
Now scroll down the page, past the information outlining what this section provides, how
to use the software, license details, etc., until you reach the section header called
'Tags'; this is where the tag we will use is listed.
For now we want as small an image as possible, hence we will look for an Oracle Linux 8 tag
called 'slim' - which similar to a minimal install
Note that both Oracle Linux 7 and Oracle Linux 8 64-bit images, for Intel, and ARM are provided.
Anyway we want the Intel Oracle 8 'slim' version, and this site shows us that the tag we should
use is '8-slim'.
Note that the website also provides the 'docker pull' command to use. However as we are using
Podman, we need to replace the reference to Docker with Podman like so:
podman pull container-registry.oracle.com/os/oraclelinux:8-slim
Wait while it downloads, then confirm it has downloaded locally by typing 'podman images'
- which will list all the containers currently residing on the machine.
If you want to verify that it really does run, you can start the container and open
a shell, by entering this command:
podman run --name=oracleshell -it container-registry.oracle.com/os/oraclelinux:8-slim /bin/bash
Now you are connected to a running instance of the Oracle Linux 8 container you just downloaded.
We can verify that we have now connected to the container by running 'whoami' - notice
it returns the 'root' user...
So to leave this container and return back to our normal environment enter the 'exit'
command.
So now we have downloaded an Oracle Linux 8 container from the Oracle-hosted public
registry, and run it.
We have also touched on how Podman knows which registries to use whilst searching
The 'registries.conf' file can be edited further as needed, however covering all the options
is beyond the scope of this video
For now, I hope this overview of what a Public Container registry is, together with how Podman
knows which registries to search and a short demonstration of using the Oracle Regisry
has helped.
In the meantime, many thanks for watching.
For additional information on Oracle Podman please access the Oracle Linux documentation,
or Oracle Linux learning library.