Build a container image

You can build a RHEL container image to encapsulate your operating system configuration and applications in a single artifact. Managing your system lifecycle by using standard container tools ensures consistent deployments across hybrid infrastructure.

Before you begin

  • The container-tools meta-package is installed.

Procedure

  1. Create a Containerfile:
    FROM quay.io/<namespace>/<image>:latest
    RUN dnf -y install cloud-init && \
        ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants && \
        dnf clean all

    This Containerfile example adds the cloud-init tool, so it automatically fetches SSH keys and can run scripts from the infrastructure. The tool gathers configuration and secrets from the instance metadata. For example, you can use this container image for pre-generated AWS or KVM guest systems.

  2. Build the <image> image by using Containerfile in the current directory:
    $ podman build -t quay.io/<namespace>/<image>:<tag> .

Results

  • List all images:
    $ podman images
    REPOSITORY                                  TAG      IMAGE ID       CREATED              SIZE
    localhost/<image>                           latest   b28cd00741b3   About a minute ago   2.1 GB