In this video, I'll show you how to run a private registry.
So to host a private registry, you can use the registry container image.
You can find it at docker.io slash library slash registry.
And the registry is typically available at port 5000.
When you run a registry container, make sure that the dedicated persistent storage is available.
Otherwise, you would lose everything if the container is deleted.
The registry container by default is insecure, and that's okay.
We don't want to do TLS certificates as well.
But in order to use it, you must make sure that in etccontainersregistry.conf.d slash
registry.conf, you have the following section.
So you have a registry section with the location of your registry, and insecure is true.
Let me demonstrate how you can run a private registry.
So I'm starting by creating a local directory that we can use as the bank-mounted storage
within the registry.
And then I'm getting to the .config slash containers slash systemd slash registry.container.
I need to create this file to make it a perfectly quadlet-managed file.
So here I'm specifying what I want.
Well, I want a container section with the image set to docker.io slash library slash
registry.
Let's do version 2.
And then exec is going to use entrypoint.sh etc.docker.registry.config.yml.
And then to provide for the persistent storage, we need the volume section.
We haven't seen that before in quadlets, but it's actually quite simple.
Volume is using %h for the host directory slash registry.
And that's what we are going to mount on var lib registry, colon z, colon z is taking care
of the svlinux.
Next we need publish port is 5000, colon 5000 to ensure that the registry container is accessible
from the outside as well.
Then we have install with a wanted by is default.target.
Next I can use systemctl minus minus user daemon reload.
And systemctl minus minus user start registry.service.
This is the first time that I'm using the registry container, so it might take a while
to run.
Popman PS should show that it is running, and as you can see, it is running.
So now let me complete the demo.
Here you can see the steps that I'm going to run.
So I'm using popman pull docker.io slash library slash nginx.
This is a random nginx container image file.
Next I'm using popman tag to tag it.
It's like creating a symbolic link, and I'm tagging this image library nginx as localhost
colon 5000 slash nginx.
So if I use popman images, then we can see that we have two images that are both pointing
to the same image ID that is the registry image.
So now I'm going to popman push localhost colon 5000 slash mynginx.
So now I'm going to popman push localhost colon 5000 slash nginx, which should automatically
upload it to the image registry.
And as you can see, that has been done.
And when I use lsregistry, now look at that.
In the registry directory, we can see that we have this registry docker container v2
and a repository.
So that is where everything is stored, and here we find the nginx image that I've just
pushed.
That's in the bindmounted directory, and that is because the bindmounted directory is really
where it is stored to guarantee the persistency of the images in the registry.