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

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

    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

How to reduce Red Hat Fuse image size

October 10, 2019
Pramod Padmanabhan
Related topics:
ContainersKubernetes
Related products:
Red Hat FuseRed Hat OpenShift

    Red Hat Fuse is a leading integration platform, which is capable of solving any given problem with simple enterprise integration patterns (EIP).  Over time, Red Hat Fuse has evolved to cater to a wide range of infrastructure needs.

    • Fuse on Red Hat OpenShift
    • Fuse standalone
      • Spring Boot
      • Apache Karaf
      • JBoss EAP

    For more information on each of these, check out the Red Hat Fuse documentation. The Fuse on Red Hat OpenShift flavor uses a Fuse image that has runtime components packaged inside a Linux container image.  This article will discuss how to reduce the size of the Fuse image. The same principle can be used for other images.

    Deep dive

    Before reducing the size, we need to first understand the basics of the Fuse container image provided by Red Hat.

    Let's dive into the Fuse image to understand its layers at a high level.  The following diagram shows six critical layers. Note, that for the sake of simplification, I have merged layers into one logical layer. For instance, Environment and Labels are shown as one layer, which provides the Metadata information.

    Current Fuse Image layeringFigure 1: High-level image layers of Red Hat Fuse images.

    The current version of the Red Hat Fuse image is about 171.8 MB in size. In Figure 1, we can see several layers. Each layer can be replaced by various alternatives.  That's good, but how do we know what the alternatives are?

    Let's take an example. Red Hat released a new Universal Base Image in April, and it's generally offered in two versions:

    1. Standard Red Hat base image — Contains a robust set of software features like yum, utils, and more.
    2. Minimal Red Hat base image — This is a stripped-down version. Some alternatives are provided, such as microdnf for software installation.

    The Minimal version is about half the size of the Standard Red Hat base image. This can be used as a replacement for the "openjdk18-rhel7" layer in a Fuse image. But this version cannot be used as is, because it does not contain JVM.

    Let's use the headless Open JDK to keep the JRE light. The image file will look like this:

    FROM registry.access.redhat.com/ubi7/ubi-minimal:7.7-98
    MAINTAINER Pramod Padmamabhan[ppadmana@redhat.com]
    
    #Adding env details
    ENV FIS_JAVA_IMAGE_NAME="jboss-fuse/minimal-fuse-openshift" \
    FIS_JAVA_IMAGE_VERSION="7.7-98" \
    PATH=$PATH:"/usr/local/s2i" \
    JAVA_DATA_DIR="/deployments/data" # BASE version information
    LABEL name="$FIS_JAVA_IMAGE_NAME" \
    version="$FIS_JAVA_IMAGE_VERSION" \
    architecture="x86_64" \
    summary="Platform for building and running plain Java applications (fat-jar and flat classpath)" \
    com.redhat.component="jboss-fuse-x-fuse-java-openshift-container" \
    io.fabric8.s2i.version.maven="3.3.3-1.el7" \
    io.k8s.description="Platform for building and running plain Java applications (fat-jar and flat classpath)" \
    io.k8s.display-name="Fuse Integration Services - Java" \
    io.openshift.tags="builder,java" \
    io.openshift.s2i.scripts-url="image:///usr/local/s2i" \
    io.openshift.s2i.destination="/tmp" \
    org.jboss.deployments-dir="/deployments" \
    description="Fuse Base Image With minimal UBI" \ group="ubi-minimal"
    
    USER root
    ADD run-java/ /opt/run-java
    ADD s2i/ /usr/local/s2i
    ADD jolokia /opt/jolokia #install OpenJDK 1.8 / use only when getting ubi minimal image
    RUN microdnf --enablerepo=rhel-7-server-rpms install java-1.8.0-openjdk-headless \
    && microdnf clean all \
    && echo securerandom.source=file:/dev/urandom >> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.el7_6.x86_64/jre/lib/security/java.security \
    && useradd -r jboss \
    && usermod -g root -G jboss jboss \
    && chmod -R 755 /opt/run-java ; chmod -R 755 /usr/local/s2i \
    && mkdir -p /deployments/data \
    && chmod -R "g+rwX" /deployments \
    && chown -R jboss:root /deployments \
    && chmod 444 /opt/jolokia/jolokia.jar \
    && chmod 755 /opt/jolokia/jolokia-opts \
    && chmod 775 /opt/jolokia/etc \
    && chgrp root /opt/jolokia/etc
    
    #fis user
    USER 185
    CMD [ "/usr/local/s2i/run" ]

    For the complete source and library of the minimal-UBI project, refer to the GitHub repo.

    Building the above will generate a Fuse image of about 130 MB. Compared to the original Fuse image size of 171.8 MB. We have reduced the image by about 40 MB in size.

    What's next?

    The size reduction is good, but every custom change comes with a few drawbacks. In this case, we need to manage the S2i, Jolokia, and any other libraries or scripts we add to the UBI. Coming up, I will show how to reduce the Final-S2i image size. Until then, happy open sourcing!

    Last updated: July 1, 2020

    Recent Posts

    • Red Hat UBI 8 builders have been promoted to the Paketo Buildpacks organization

    • Using eBPF in Red Hat products

    • How we made one data layer serve the UI, the mocks, and the E2E tests

    • Build trusted Python containers with Project Hummingbird and Calunga

    • Simplify distributed tracing: ObservabilityInstaller installation

    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