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

Dockerfiles now available for Red Hat Software Collections

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

December 3, 2014
Joe Orton
Related topics:
ContainersLinux
Related products:
Red Hat Enterprise Linux

    Shipping_containers_at_ClydeWe recently announced that we've made available a set of Dockerfiles for Red Hat Software Collections.  We are making these available since we think they may be useful to customers looking to build more complex application containers on top of RHEL and RHSCL. We don't intend the Dockerfiles to produce useful standalone images which you'll immediately put in production - the Docker images which these create are very simple containers which give you RHEL plus the basic set of packages from a particular RHSCL collection.

    There are two different ways to get your hands on the Dockerfiles:

    1. From the upstream source at github 
    2. From a new package, rhscl-dockerfiles, which we've shipped in the RHSCL channels - both for RHEL6 and RHEL7

    We have Dockerfiles available for each of the following collections in RHSCL 1.2: httpd24, mariadb55, mongodb24, mysql55, nginx16, nodejs010, perl516, php54, php55, postgresql92, python27, python33, ror40, ruby193, and ruby200.

    I'll walk through the second option here and demo the httpd24 collection.  I'm using the docker package from the RHEL Extras channel - RHEL customers can use this to access the base images for RHEL 6 and 7.  You'll need both the Extras channel and the RHSCL channel enabled to replicate this.  You may also need to configure the docker service to run in your environment, for example to change the networking configuration, but it should work out of the box.

    softwarecollections-logo-colorful

    First up we build a docker image; note I tagged the image (the "-t httpd24-el7" argument) so it's easy to refer to later.

    # yum install rhscl-dockerfiles
    ...
    Installed:
      rhscl-dockerfiles.noarch 0:1.2-4.el7
    
    Complete!
    # systemctl start docker
    # docker build -t httpd24-el7 /usr/share/rhscl-dockerfiles/rhel7/httpd24/
    Sending build context to Docker daemon 4.608 kB
    Sending build context to Docker daemon
    Step 0 : FROM rhel7
    ...
    Step 7 : EXPOSE 80
     ---> Running in 8fb43a750ad1
     ---> 5f337d2429f8
    Removing intermediate container 8fb43a750ad1
    Step 8 : EXPOSE 443
     ---> Running in 7d406717cb8c
     ---> 9e658e4a8417
    Removing intermediate container 7d406717cb8c
    Step 9 : ADD ./enablehttpd24.sh /etc/profile.d/
     ---> 4e19e92e1a90
    Removing intermediate container a6254b587d06
    Successfully built 4e19e92e1a90
    #

    In that transcript I've omitted the intermediate steps in the Dockerfile, which are mostly running "yum", but the last ones I've left in  The "EXPOSE" instruction exposes ports so they can be used from other contains.  The last instruction drops a bash login script into the system's "profile.d" directory.  This enables the SCL for a login shell.  Here's a demo, running "bash -l" to get a login shell

    # docker run -i -t httpd24-el7 bash -l
    bash-4.2# echo $X_SCLS
    httpd24
    bash-4.2# httpd -V
    Server version: Apache/2.4.6 (Red Hat)
    Server built: Jul 18 2014 06:22:07
    ...
     -D HTTPD_ROOT="/opt/rh/httpd24/root/etc/httpd"
    ...
    bash-4.2#

    That shows we have the RHSCL version of httpd.  If we did want to use that image... how to get it doing something useful?  Here I'll show the RHSCL httpd running using a filesystem mounted from the host, and mapping the port out:

    # mkdir /srv/www
    # echo 'Hello, Docker world.' > /srv/www/index.html
    # chcon -Rt svirt_sandbox_file_t /srv/www
    # docker run -d -v /srv/www:/opt/rh/httpd24/root/var/www/html -p 8080:80 httpd24-el7 scl enable httpd24 'httpd -DFOREGROUND'
    76e0705a9cdfc43389262e38460b16e8d7a31a2e7fba42cfb680bb5fe301f83a
    # curl http://localhost:8080/
    Hello, Docker world.
    #

    There is one trick above which might not be familiar to regular Docker users: I had to apply a special SELinux label, "svirt_sandbox_file_t", to the directory in the host system before it can be accessed from the container.  More details on that in the RHEL7 container guide. Otherwise, the "docker run" command does three things: it daemonizes (-d), and maps in the filesystem volume (-v) and port (-p).  The paths are appropriate to the RHSCL httpd24 collection, and httpd itself is run under "scl enable" so the SCL environment is set up correctly.

    That's it for a quick guide.  Let us know in the comments if you have use cases for  RHSCL Dockerfiles which you think we should address, or combinations of SCLs which you'd like to see shipping.

    Last updated: November 2, 2023

    Recent Posts

    • Every layer counts: Defense in depth for AI agents with Red Hat AI

    • Fun in the RUN instruction: Why container builds with distroless images can surprise you

    • Trusted software factory: Building trust in the agentic AI era

    • Build a zero trust AI pipeline with OpenShift and RHEL CVMs

    • Red Hat Hardened Images: Top 5 benefits for software developers

    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.