Skip to main content
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 Red Hat 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

    • Red Hat OpenShift AI
    • 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.

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

    • 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.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Container Images for OpenShift – Part 3: Making your images consumable

<p>&nbsp;</p> <quillbot-extension-portal></quillbot-extension-portal>

October 16, 2017
Frédéric Giloux
Related topics:
ContainersKubernetes
Related products:
Red Hat OpenShift Container Platform

    This is a transcript of a session I gave at EMEA Red Hat Tech Exchange 2017, a gathering of all Red Hat solution architects and consultants across EMEA. It is about considerations and good practices when creating images that will run on OpenShift. This third part focuses on how you can make your images easier to consume by application developers or release managers.

    Versioning

    When you specify an image for starting containers or creating child images you need to provide the version you want to use. If you don't the version with the "latest" tag is used.

    Let's have a look at the way Red Hat creates a version hierarchy. This is a good example of a strategy that you could reuse for your own images.

    A very important aspect is maintaining backward compatibility within a tag for downstream consumers. The publication of a new version of the image should not break the child images.

    Red Hat image versions are aligned with the product, which is part of the container. Here is, for instance, the way rhel7/rhel is tagged:

    7.4-81 / 7.4 / latest
    7.3-97 / 7.3
    7.3-95
    7.3-82
    ...

    Note that there isn't a 7 tag, as compatibility is not guaranteed between major releases only between minor releases. See the bottom of this article. The tags 7.4-81, 7.4 and the latest reference the same image. The image consumer is free to point to one of these tags with the consequence:

    • latest: The consumer gets a different image every time a new version is pushed.
    • 7.4: The consumer gets a different image every time a new version of the minor release 7.4 is pushed. Child images get patches automatically.
    • 7.4-81: The consumer does not get updates.

    For anything that you aim to validate and run in production, you should target a stable tag and not use the latest. The recommendation is to point to the minor release: 7.4 in the example so that your image is automatically updated with patches. If you go for a specific release: 7.4-81 you will need to have a suitable workflow in place for patching your own images.

    You may use the latest tag inside the project where the image is developed for seeing the latest changes automatically. More rarely, you may want, during your development phase, to be on the latest version, whenever it is made available, of an image you consume.

    Documentation

    The next aspect in making your image consumable is obviously documentation. A user guide is certainly something useful but there are also things you can do to the image or OpenShift level.

    Providing a template with a quick start shows how users can run applications based on your image.

    Using the image metadata, you can have the most important points documented with the image itself:

    • You can use labels to add a description, to provide contact information of the maintainer, the address of the authoritative source, build, release and component information, etc.
    • Exposing important ports in the Dockerfile gives also important information on how the image should be run and your application connected to.
    • Same with exposing volumes. The image consumer is then aware of where data gets written inside the image that may need to be persisted.
    • Setting environment variables like PATH, JAVA_HOME and sound defaults for the configuration of your image also help for an easy start.
    • Finally, you must specify with CMD or ENTRYPOINT how your image process starts.

    Here is an extract of the metadata available with the RHEL7 image. The complete set is available here.

    rhel7/rhel

    Env
        PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        container=oci
    Cmd
        /bin/bash
    Labels
        com.redhat.component rhel-server-docker
        authoritative-source-url registry.access.redhat.com
        distribution-scope public
        vendor Red Hat, Inc.
        description The Red Hat Enterprise Linux Base image...
    [...]

    Extension points

    In part 2 we had the first glimpse at extension points. It is important to enable the image consumer to cover scenarios and configurations that either cannot be foreseen by the image creator or where the number of combinations would make it unmanageable. Extension points aim to avoid the need of rewriting layers you have created as part of your image.

    Injecting environment information at runtime

    This can be done in two ways: with setting environment variables and with mounting files into the container file system at startup.

    Environment variables can just be added to the deployment configuration or provided by ConfigMap. You may use this way to specify the address of a service that is called by your application.

    Files can be mounted on the container from ConfigMap to provide for instance logging configuration or from Secrets to provide certificates or other credentials required by the application.

    Configuration at build time

    If you have created a builder image, you may also want the user to inject the build configuration. You can, for instance, allow specifying a maven repository with an environment variable. This may however not be sufficient and your builder image should allow the user to inject complete settings.xml with the sources.

    You may have defined in an assemble script the compilation of the application and the configuration of the image. A level of flexibility in term of libraries and drivers provisioned into the final image can be provided with image sourcing (confer part 2 of this blog) but still, it is a good idea to allow the image user to adapt the build process by extending or replacing some of its logic. This can be done for instance by making scripts sourced or called in the assemble script replaceable by scripts provided by the user with the application sources.

    External builds

    In part 2 we also had a glimpse at allowing the user to build the application externally and to only have the container image built on OpenShift. The rationale behind that is that companies may have invested in automated and integrated CI/CD pipelines and related infrastructure before the introduction of container technologies. External builds allow them to go on with using this infrastructure as they are moving to a container as a service platform.

    There are two sensible approaches for that. The first one consists in streaming the application artifacts into the builder image from the CI tool (Jenkins for instance) through a binary build.

    The second approach is to download the artifacts from a company repository. This can be done with curl or wget but for java applications where you may already have maven in the builder image the maven dependencies plugin is a convenient way.

    Last updated: April 3, 2023

    Recent Posts

    • Streamlining Red Hat OpenShift support with the new support log gather operator

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    What’s up next?

     

    Red Hat Developers logo

    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
    Ask AI