14 Private Container Registries
Set up a local, private container registry server to host container images within an organization. A private registry can also be used to mirror the Oracle Container Registry.
The registry server is a container application. The host must have an Internet connection to download the registry image from Docker Hub or, if support is required, from the Oracle Container Registry.
You can create a secure private registry, which requires you to set up TLS. When you set up TLS, you can use a self signed Certificate Authority (CA) certificate, or a certificate signed by a CA. Otherwise, the registry can be created as an insecure registry for testing and development purposes.
Note:
The registry image from Docker Hub can be used to set up both an insecure registry and a secure registry. The registry image from the Oracle Container Registry can only be used to set up a secure registry.
Creating an Insecure Registry
Create a local container registry without TLS. This can be used for testing or development. A secure registry that uses TLS is recommended for a production system.
If you create an insecure registry, you can add it to the Podman registry configuration file to avoid using the --tls-verify=false
option when using the registry. For more information, see Adding Insecure Registries.
Creating a Secure Registry
Create a local container registry with TLS. A secure registry that uses TLS is recommended for a production system.
Before you begin, ensure you have considered the prerequisites:
-
The registry server requires at least 15 GB of available disk space to store registry data in
/opt/registry/
. -
As a good practice, create a separate file system for the registry, preferably a Btrfs formatted file system. By using the Btrfs file system, you can easily scale the registry file system and leverage Btrfs features such as file system snapshots. For information on setting up Btrfs, see the following documents:
-
The registry host requires a valid X.509 certificate and private key to enable Transport Layer Security (TLS) with the registry, similar to using TLS for a web server. You can use either a certificate signed by a trusted Certificate Authority (CA), or a self signed certificate. A self signed certificate can be used for testing purposes. For information about creating a self signed certificate and private key, see Oracle Linux: Managing Certificates and Public Key Infrastructure.
If the host already has an X.509 certificate, you can use it with Podman to create the private registry. If you're using the host's X.509 certificate and it was issued by an intermediate CA, combine the host's certificate with the intermediate CA's certificate to create a chained certificate. This creates a certificate that includes the both the host and intermediate CA certificate so it can be validated by Podman. Use the
cat
command to do this, using the format:sudo cat host_certificate.crt intermediate_certificate.pem > chained_certificate.crt
For example:
sudo cat myregistry.example.com.crt intermediate-ca.pem > domain.crt
Distributing X.509 Certificates
If the registry host uses a self-signed X.509 certificate, you must distribute the certificate to all the hosts in the deployment for which you intend to use the local container registry.
For the root user, certificates for each registry are stored in /etc/containers/certs.d/registry_hostname:port/
. For standard users, certificates can be stored in $HOME/.config/containers/certs.d/registry_hostname:port/
. Change registry_hostname to the name of the registry host, and port to the port number for the container registry server (5000 by default).
Podman, Buildah, and Skopeo commands that interact with registries also often provide a --cert-dir
option to specify an alternate location for these certificates.
Importing Images Into a Registry
When you have set up a private container registry, you can import images into the registry so that they can be used to deploy containers. You can pull images from a registry, such as the Oracle Container Registry, and then commit them to a local registry. You can also create custom images based on upstream images.
See Buildah for more information about how you can create images. When you have committed a customized image, you can tag it and push it to the local registry.