OpenShift Online provides S2I enabled Perl images for building and running Perl applications. The Perl S2I builder image assembles your application source with any required dependencies to create a new image containing your Perl application. This resulting image can be run either by OpenShift Online or by a container runtime.


Currently, OpenShift Online supports versions 5.16, 5.20, and 5.24 of Perl.


RHEL 7 images are available through the Red Hat Registry:

$ docker pull registry.redhat.io/openshift3/perl-516-rhel7
$ docker pull registry.redhat.io/rhscl/perl-520-rhel7
$ docker pull registry.redhat.io/rhscl/perl-524-rhel7

You can use these images through the perl image stream.

Build Process

S2I produces ready-to-run images by injecting source code into a container and letting the container prepare that source code for execution. It performs the following steps:

  1. Starts a container from the builder image.

  2. Downloads the application source.

  3. Streams the scripts and application sources into the builder image container.

  4. Runs the assemble script (from the builder image).

  5. Saves the final image.

See S2I Build Process for a detailed overview of the build process.


The Perl image supports a number of environment variables which can be set to control the configuration and behavior of the Perl runtime.

To set these environment variables as part of your image, you can place them into a .s2i/environment file inside your source code repository, or define them in the environment section of the build configuration’s sourceStrategy definition.

You can also set environment variables to be used with an existing image when creating new applications, or by updating environment variables for existing objects such as deployment configurations.

Environment variables that control build behavior must be set as part of the s2i build configuration or in the .s2i/environment file to make them available to the build steps.

Table 1. Perl Environment Variables
Variable name Description


When set to true, this variable installs all the cpan modules and runs their tests. By default, the testing of the modules is turned off.


This variable specifies a mirror URL which cpanminus uses to install dependencies. By default, this URL is not specified.


Set this to true to enable automatic reloading of modified Perl modules. By default, automatic reloading is turned off.


The StartServers directive sets the number of child server processes created on startup. Default is 8.


Number of simultaneous requests that will be handled by Apache. The default is 256, but it will be automatically lowered if memory is limited.

Accessing Logs

Access logs are streamed to standard output and as such they can be viewed using the oc logs command. Error logs are stored in the /tmp/error_log file, which can be viewed using the oc rsh command to access the container.

Hot Deploying

Hot deployment allows you to quickly make and deploy changes to your application without having to generate a new S2I build. To enable hot deployment in this image, you must set the PERL_APACHE2_RELOAD environment variable to true. For example, see the oc new-app command. You can use the oc set env command to update environment variables of existing objects.

You should only use this option while developing or debugging; it is not recommended to turn this on in your production environment.

To change your source code in a running pod, use the oc rsh command to enter the container:

$ oc rsh <pod_id>

After you enter into the running container, your current directory is set to /opt/app-root/src, where the source code is located.

Perl Templates

OpenShift Online includes an example template to deploy a sample Dancer application. This template builds and deploys the sample application on Perl 5.24 with a MySQL database using a persistent volume for storage.

The sample application can be built and deployed using the rhscl/perl-524-rhel7 image with the following command:

$ oc new-app --template=dancer-mysql-persistent