Enable Redhat SCL in Docker

1 minute read Published:

The SCL is a repository that you can install and activate on CentOS/Redhat to enable new versions of some software.

For example, gcc is 4.x on CentOS 7, but you can get 6.x with an SCL. This is how you enable SCL for gcc:

[root@2136cd3e0461 /]# scl enable devtoolset-6 bash
[root@2136cd3e0461 /]# gcc --version
gcc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3)

This modifies your current shell, making it difficult to use effectively in a Docker container. The following is how I use SCL in a Docker container:

FROM centos:7

RUN yum install -y \
  gcc \
  make \
  centos-release-scl \
  scl-utils

RUN yum install -y devtoolset-6-gcc*

ENTRYPOINT ["scl", "enable", "devtoolset-6", "--", "bash", "-c"]

This way, the entrypoint has SCL enabled.