Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Build and store universal application images on OpenShift

November 18, 2021
Bobby Woolf
Related topics:
CI/CDContainersDevOpsKubernetes
Related products:
Red Hat OpenShift

    After designing a universal application image that will run well on Kubernetes or Red Hat OpenShift—and that will pass Red Hat Container Certification—your next consideration is how to successfully build and store each image. This article discusses how to use a build pipeline to implement two best practices: Automating compliance with the Open Container Initiative (OCI) and tagging each image with a unique identifier. Using a build pipeline to build and store images automates the process and makes it repeatable and reliable. I'll also discuss the Red Hat Container Certification requirements for each of these best practices.

    A quick review of CI/CD pipelines

    As a reminder, a build pipeline performs continuous integration in a pipeline that provides continuous delivery (CI/CD) as part of DevOps or DevSecOps for a software development lifecycle. Every time the code for a software component changes, the CI pipeline builds the software, packages it for deployment, and deploys it into a development or test environment.

    CI/CD pipelines:

    • Confirm that the latest code can be built and deployed.
    • Ensure that the deployed component is always running the latest code.
    • Perform quality checks on the code.
    • Prevent deployment if the software falls below an acceptable level of quality.

    Best practice #1: Build images for OCI compliance

    The Open Container Initiative (OCI) is a neutral body that governs open industry standards for the container image format (image-spec), how images are stored and distributed (distribution-spec), and how images are run as containers (runtime-spec).

    Images built for OCI compliance avoid vendor lock-in. Any OCI-compliant container can run properly in any OCI-compliant container engine, such as containerd and CRI-O.

    Red Hat Container Certification requirement

    Although Red Hat does not require that images be built with specific tools, it does recommend a set of open source tools to build, transfer, and run OCI-compliant images: Buildah, Skopeo, and Podman. These tools currently run most easily on Linux, with varying support for Windows or MacOS.

    You should use Buildah to build images and Skopeo to copy them between registries. You can also use Podman to run images locally, although that doesn’t matter when deploying images to a container orchestrator. OpenShift supports using Buildah to build images as part of an integrated build process with all three tools.

    Build an image with Buildah

    Use Buildah’s bud command to build an image like this:

    buildah bud -f Dockerfile .

    bud stands for "build using dockerfile." Buildah refers to the file that contains the build instructions as either the Dockerfile or the Containerfile. Regardless of the file name, they use the same syntax.

    Best practice #2: Tag each image with a unique identifier

    When adding an image to a registry, tag the image to indicate the version of the software and the release of the build inside the image.

    Red Hat Container Certification requirement

    Red Hat Container Certification requires that an image have a tag (other than latest, which is automatic) that uniquely identifies that image from others with the same name. It suggests that the tag should commonly be the image version.

    Tagging your image

    Use Docker’s tag command to add a tag to an image. An image can have multiple tags, which are aliases for the same image file. For example:

    1. Build the image: my-image.
    2. Tag it for the registry: my-registry and the namespace my-namespace, and with the version 1.0 and the release 1.
    3. Tag it again without the release, for the latest release of that version.
    4. Push all tags of the image to the remote registry my-registry.

    Your command should look something like this:

    docker build -t my-image .
    docker tag my-image my-registry/my-namespace/my-image:1.0-1
    docker tag my-image my-registry/my-namespace/my-image:1.0
    docker push --all-tags my-registry/my-namespace/my-image

    This tags the image with two tags:

    • 1.0-1 specifies release 1 of version 1.0.
    • 1.0 specifies the latest release of version 1.0.

    The registry should not already contain an image with the tag 1.0-1; if it does, the old image will no longer have that tag. If this were tag 1.0-2, the registry typically already contains an image with the tags 1.0-1 and 1.0. The new 1.0 tag replaces the old one in the registry, so whereas the 1.0 used to point to the 1.0-1 image, now it points to the 1.0-2 image. Likewise, you could even add a 1 tag to point to the latest image that is a 1.x version. For example, see all the tags for various builds of the node image in DockerHub and notice how a single build often has multiple tags that act as aliases for the same build.

    The image’s identifiers in the registry should match its internal identifiers. An image should contain these three identifying fields:

    • name: Name of the image.
    • version: Version of the image.
    • release: A number that’s used to identify the specific build for this image.

    To make the registry identifiers match, tag the image with these same identifier values:

    docker tag <registry>/<namespace>/<name>:<version>-<release>

    where <registry> and <namespace> specify where the image is stored.

    Conclusion

    This article discussed best practices for building and storing images and showed you how to use a build pipeline to automate OCI compliance and tagging images with a unique identifier.

    Last updated: September 20, 2023

    Related Posts

    • Best practices for building images that pass Red Hat Container Certification

    • Best practices for running Buildah in a container

    • Building freely distributed containers with Podman and Red Hat UBI

    • Podman and Buildah for Docker users

    Recent Posts

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.