1.8. Using Red Hat Developer Toolset Container Images

Starting with Red Hat Developer Toolset 3.1, Dockerfiles are available for selected Red Hat Developer Toolset components. Dockerfiles are text documents that contain instructions for automated building of docker-formatted container images. The resulting container images can be used to run Red Hat Developer Toolset components inside virtual software containers, thus isolating them from the host system and allowing for their rapid deployment. This section describes how to obtain Red Hat Developer Toolset Dockerfiles, how to use them to build docker-formatted container images, and how to run Red Hat Developer Toolset components using the resulting container images.
Red Hat Developer Toolset 3.1 is shipped with the following Dockerfiles:
  • devtoolset-3-dyninst
  • devtoolset-3-elfutils
  • devtoolset-3-oprofile
  • devtoolset-3-systemtap (only for Red Hat Enterprise Linux 7)
  • devtoolset-3-toolchain
  • devtoolset-3-valgrind
  • devtoolset-3 (only for Red Hat Enterprise Linux 7)

Note

The docker package, which contains the Docker daemon, command line tool, and other necessary components for building and using docker-formatted container images, is currently only available for the Server variant of the Red Hat Enterprise Linux 7 product. Red Hat Developer Toolset Dockerfiles are distributed for Red Hat Enterprise Linux 6 as well, but the images built using them can only be deployed on Red Hat Enterprise Linux 7 Server.

1.8.1. Obtaining Dockerfiles

The Red Hat Developer Toolset Dockerfiles are provided by the devtoolset-3-dockerfiles package. The package contains individual Dockerfiles for building docker-formatted container images with individual components and a meta-package for building a docker-formatted container image with all the components offered. To be able to use the Dockerfiles, install this package by executing:
~]# yum install devtoolset-3-dockerfiles
Note that because some Red Hat Developer Toolset components depend on packages from the Optional channel, the provided Dockerfiles contain instructions that enable the channel automatically.

1.8.2. Building Container Images

Follow the instruction outlined at Getting Docker in RHEL 7 to set up an environment for building and using docker-formatted container images.
When you are ready to build your image, change to the directory where the Dockerfile is installed and run the docker build command as shown in the following example.

Example 1.1. Building a Container Image with a Red Hat Developer Toolset Component

To build a docker-formatted container image for deploying the elfutils tools in a container, follow the instructions below:
  1. Make sure you have a Docker environment set up properly on your system by following instructions at Getting Docker in RHEL 7.
  2. Install the package containing the Red Hat Developer Toolset Dockerfiles:
    ~]# yum install devtoolset-3-dockerfiles
  3. Determine where the Dockerfile for the required component is located:
    ~]# rpm -qpl devtoolset-3-dockerfiles | grep "elfutils/Dockerfile"
  4. Change to the directory where the required Dockerfile is installed:
    ~]# cd /opt/rh/devtoolset-3/root/usr/share/devtoolset-3-dockerfiles/rhel7/devtoolset-3-elfutils/
  5. Build the container image using the docker build command:
    ~]# docker build -t devtoolset-3-elfutils-7 .
    Replace devtoolset-3-elfutils-7 with the name you wish to assign to your resulting container image.

1.8.3. Running Red Hat Developer Toolset Tools from Container Images

To launch the docker-formatted container image you built (see Section 1.8.2, “Building Container Images”), execute the docker run command as follows:
docker run -t -i container-image /bin/bash -l
Substitute the container-image parameter with the name of the container image you chose when building it.
For example, to launch the container image built in Example 1.1, “Building a Container Image with a Red Hat Developer Toolset Component”, run the following command:
~]# docker run -t -i devtoolset-3-elfutils-7 /bin/bash -l