Skip to main content
Redhat Developers  Logo
  • Products

    Platforms

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat AI
      Red Hat AI
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • View All Red Hat Products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat Developer Hub
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat OpenShift Local
    • Red Hat Developer Sandbox

      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Secure Development & Architectures

      • Security
      • Secure coding
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • Product Documentation
    • API Catalog
    • Legacy Documentation
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Moving an RHSCL app to Docker on Atomic

 

May 7, 2014
Langdon White
Related topics:
ContainersLinux
Related products:
Red Hat Enterprise Linux

Share:

    As many of you have probably heard, Red Hat announced a new "Docker server" at Summit. The new server is called "Atomic" and details can be found at the project home page. As you all know, I tend to be interested in using Software Collections to ensure the portability of applications. So, putting my foot^W money where my mouth is, I decided to download Atomic, run it as a VM, create a Docker image with a Software Collection, and copy a previous app there, unchanged. The pros and cons of running an application as a Docker container are debated heavily elsewhere, so we won't discuss the "why" (unless you tell us we should in the comments :) ), just the "how."

    For a little context, I wrote an article about an application that let's you interact with Twitter via IRC using node.js and RHSCL. The application is fairly simple, but could not be run with just base RHEL, so it was a great example of a RHSCL application.

    First, I, Valhalla forbid, read the directions at the Project Atomic "Getting Started" page. Per the docs, I downloaded the xz file (which, weirdly, does not include "atomic" anywhere in the filename), extracted the qcow2 file, made a VM, and added some extra storage with another raw file. In general, I didn't have any trouble with following the Quick Start Guide except for a couple confusing steps (which I think were a mismatch between the version of virt-manager used for the doc and the one in RHEL 7). Basically, you have to pick the VM name at the beginning and F20 is not a choice. I just chose a Fedora that was available.

    However, when I went to go actually "use" the VM, I found myself to be mildly confused. Is Atomic meant to be used like Vagrant, where I run the Docker commands outside the VM, or should I be running the commands inside the running VM? Upon consultation with Joe Brockmeier, one of the community folks for Project Atomic, I found out that you run the commands in the VM. And, per Joe, "Langdon, I think you might be overthinking it." To which I say, "yeah, I have a talent."

    Ok, now that Atomic is installed, I need to go make a container. After a few fits and starts, mostly related to pathing issues while using the "RUN" command, I got a decent Dockerfile working. You "run" this file by using the "docker build" command. Later, you "make the app go" with the "docker run" command. I have excerpted it below:

    FROM centos
    # Install scls and nodejs
    RUN yum update -y
    RUN yum install -y centos-release-SCL
    RUN yum update -y
    RUN yum install -y scl-utils nodejs010
    # Clean up
    RUN yum clean all
    #FROM 1angdon/node-scl-centos
    # ^^^ this is a good place to break to make multiple app containers
    #add app
    ADD . /src
    RUN cd /src; scl enable nodejs010 "npm install"
    CMD cd /src; scl enable nodejs010 "node server.js"

    To start, you may notice I used CentOS as the base image. (Currently, RHEL is not available as a base image.) I then proceed to make sure everything is current. Then I move on to adding a repository for the Software Collections available in CentOS:

    RUN yum install -y centos-release-SCL

    I then do another update and then install the nodejs (v0.10) scl. I also install scl-utils, which, honestly, I think is a dependency, but better safe than sorry. I then clean up yum to remove anything it downloaded to try to save on space, as I won't be downloading anything else via yum.

    The next line is just a comment to show that if I was doing this in a "real" environment, I would probably break the Dockerfile here and use the part above the break as a base nodejs image. I then proceed to add my source files, basically (more on this later) the exact same ones from the earlier article. I then use npm to add my node dependencies. Finally, I have a "CMD" operation which will actually start the server when using the "docker run" command.

    If you notice, I used a "cd /src;" at the beginning of each of the scl-related operations. For some reason, I was not having good luck with a "RUN cd /src" actually persisting the directory change for the next RUN command. This may be by design, or something I am missing.

    Finally, as I said above, I "basically" used the same files from the repo, however, I found some bugs in the original source :). First, I got the code working again on RHSCL, then I proceeded with the above.

    In conclusion, making Docker on Atomic version of a simple node.js app is really pretty easy. Let me know how you make out.

    Last updated: November 2, 2023

    Recent Posts

    • Install Python 3.13 on Red Hat Enterprise Linux from EPEL

    • Zero trust automation on AWS with Ansible and Terraform

    • Cloud bursting with confidential containers on OpenShift

    • Reach native speed with MacOS llama.cpp container inference

    • A deep dive into Apache Kafka's KRaft protocol

    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
    © 2025 Red Hat

    Red Hat legal and privacy links

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

    Report a website issue