In this Podman series, we will cover tasks ranging from beginner to advanced levels. In this session, we will learn how to set up a local registry in Podman on an Ubuntu OS and manage images.
Difference between registry and repositories:
In the realm of containers, Podman, and Kubernetes, a registry is a service that stores named container images and enables users to push and pull them. Repositories consist of related images with various versions distinguished by tags. A tag is a label assigned to a specific version of a container image within a repository.
Install/setup registry
Assuming podman on ubuntu is already installed in your machine. For podman installation, click here to refer official document.
sudo apt update
sudo apt install -y podman
podman --version
create a registry using docker image
podman pull docker.io/library/registry:latest
podman run -d -p 5000:5000 --name local_registry docker.io/library/registry:latest
podman ps
Below step will include local_registry as default search and enable insecure (http) access to the registry.
cd /etc/containers/registries.conf
vi registries.conf
[[registry.search]]
registries = ['localhost:5000']
[[registry.insecure]]
registries = ['localhost:5000']
systemctl stop podman
systemctl restart podman
systemctl daemon-reload
Push/Pull images in registry:
In this section we will push an image into registry , check if the images is stored in the registry and then pull image from registry. We will also validate if podman search local registry for any image.
podman pull docker.io/nginx:latest
podman tag docker.io/library/nginx localhost:5000/nginx-template
podman push --tls-verify=false localhost:5000/nginx-template
verify images pushed in registry are stored
root@podman-vm:/etc/containers# curl -X GET http://localhost:5000/v2/_catalog
{"repositories":["my-base-nginx","nginx-template"]}
pull image from registry
podman pull nginx-template
Trying to pull localhost:5000/nginx-template:latest...
Getting image source signatures..
In summary, this article helps in creating a local registry using podman , configure podman to allow http (insecure) connections to the registry and then push / pull images through local registry.