Ce contenu n'est pas disponible dans la langue sélectionnée.
Chapter 6. Best practices for running containers by using local sources
You can access content hosted in an internal registry that requires a custom Transport Layer Security (TLS) root certificate, when running RHEL bootc images.
To install content to a container by using only local resources, you can use one of the following options:
- Bind mounts: Override the container’s store with the host’s.
-
Derived image: Create a new container image with your custom certificates by building it using a
Containerfile.
You can use these techniques to run a bootc-image-builder container or a bootc container when appropriate.
6.1. Importing custom certificate to a container by using bind mounts Copier lienLien copié sur presse-papiers!
Use bound mounts to override the container’s store with the host’s.
Procedure
Run RHEL bootc image and use bind mount, for example
-v /etc/pki:/etc/pki, to override the container’s store with the host’s:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
- The disk image build process should now be able to access internal certificates.
6.2. Importing custom certificates to a container by a using Containerfile Copier lienLien copié sur presse-papiers!
Create a new container image with your custom certificates by building it using a Containerfile.
Procedure
Create a
Containerfile:FROM <internal_repository>/<image> RUN mkdir -p /etc/pki/ca-trust/extracted/pem/ COPY tls-ca-bundle.pem /etc/pki/ca-trust/extracted/pem/ RUN rm -rf /etc/yum.repos.d/* COPY echo-rhel9_4.repo /etc/yum.repos.d/
FROM <internal_repository>/<image> RUN mkdir -p /etc/pki/ca-trust/extracted/pem/ COPY tls-ca-bundle.pem /etc/pki/ca-trust/extracted/pem/ RUN rm -rf /etc/yum.repos.d/* COPY echo-rhel9_4.repo /etc/yum.repos.d/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Build the custom image:
podman build -t <your_image> .
# podman build -t <your_image> .Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the
<your_image>:podman run -it --rm <your_image>
# podman run -it --rm <your_image>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
List the certificates inside the container:
ls -l /etc/pki/ca-trust/extracted/pem/ tls-ca-bundle.pem
# ls -l /etc/pki/ca-trust/extracted/pem/ tls-ca-bundle.pemCopy to Clipboard Copied! Toggle word wrap Toggle overflow