Creating a Docker image with RTI Connext DDS

This article assumes familiarity with Docker.  For instance, you should know the difference between containers and images, and the purpose of a Dockerfile. If not, then visit www.docker.com and get up to speed on Docker basics before reading further.

Introduction

In this example, we’ll create a Docker image that can build RTI Connext DDS applications. We’ll use Ubuntu 24.04 (x64) for the target operating system and assume that the host is also using a Linux OS*. We’ll create an image named dds-build. It will be relatively large because it holds the RTI Connext DDS installation and the Linux build tools.

*The host can use a different version of a Linux, Windows, or Mac operating system.

Creating the Build Image

Note: If you are using an evaluation version of RTI Connext DDS, you must follow a different process for creating your DDS build image. See Variation: Evals, below.

We’ll create a Docker image, named dds-build, that can build DDS applications. This image needs to include the DDS installation as well as build tools like make and gcc. The goal is to create an image that is capable of building any DDS application. When you use  dds-build to compile your RTI Connext DDS application, you will need to mount your source-code directory as a volume in the Docker container. This process is explained in a separate article.

We’ll begin by creating a directory named mybuild (or whatever you prefer).  This directory will hold the build context for creating the image:

$ mkdir mybuild

Now download the RTI Connext DDS host and target installation files and copy them to mybuild.  In this example, we use the following files:

rti_connext_dds-6.1.1-pro-host-x64Linux.run
rti_connext_dds-6.1.1-pro-target-x64Linux4gcc7.3.0.rtipkg

We now need to tell Docker what to do with these files.  Create a file named DockerfileUnlicensed in mybuild, with the following content:

# Ubuntu 20.04 is supported by RTI Connext DDS 6.1.1
# Use Docker's multi-stage build capability to create an image that
# contains only Ubuntu and the fully-installed RTI Connext distribution
FROM ubuntu:20.04 as dds_install
 
# /app will hold our installation files
WORKDIR /app

# Copy the installation files into the image
COPY rti_connext_dds-6.1.1-pro-host-x64Linux.run \
     rti_connext_dds-6.1.1-pro-target-x64Linux4gcc7.3.0.rtipkg \
     ./

# Run the host package installer
RUN chmod +x rti_connext_dds-6.1.1-pro-host-x64Linux.run && \
    ./rti_connext_dds-6.1.1-pro-host-x64Linux.run --mode unattended

# Run the target package installer
RUN /opt/rti_connext_dds-6.1.1/bin/rtipkginstall \
    -u rti_connext_dds-6.1.1-pro-target-x64Linux4gcc7.3.0.rtipkg

# Start from a fresh image
FROM ubuntu:20.04
# Copy the RTI Connext DDS installation from the image created above
COPY --from=dds_install \
     /opt/rti_connext_dds-6.1.1 /opt/rti_connext_dds-6.1.1

# Set up the DDS execution environment
ENV NDDSHOME /opt/rti_connext_dds-6.1.1
ENV PATH $PATH:$NDDSHOME/bin

# Install the license file
COPY rti_license.dat /opt/rti_connext_dds-6.1.1

# Install build tools  
RUN apt-get update && apt-get -y install build-essential

The mybuild directory should now contain these files:

DockerfileUnlicensed
rti_connext_dds-6.1.1-pro-host-x64Linux.run
rti_connext_dds-6.1.1-pro-target-x64Linux4gcc7.3.0.rtipkg
rti_license.dat 

We’re now ready to actually build the first Docker image. Use these commands to build the image:

$ cd mybuild
$ docker build -t dds-build -f DockerfileUnlicensed .

When Docker finishes running, your local Docker registry will have an image named dds-build.  You can confirm this by running:

$ docker image ls
REPOSITORY  TAG         IMAGE ID        CREATED          SIZE
dds-build   latest      f39efa68fcdf    16 seconds ago   2.6GB

Congratulations! You have created a Docker image that can be used to build DDS applications.

Variation: Evaluation and License-Managed Libraries (IRAD/Research)

If you are using an evaluation version of RTI Connext DDS, you must follow a different process for creating your DDS build image.  This is because the evaluation installer does not support unattended mode.

In order to use the evaluation version, first install it locally on your operating system.  (You must use the same operating system that will be used in the Docker DDS build image.)  For example, create a directory named mybuild_eval and install RTI Connext DDS in this directory, so that the installation path is mybuild_eval/rti_connext_dds-6.1.1.  Then create a file named DockerfileEval in mybuild_eval:

# Ubuntu 20.04 is supported by RTI Connext DDS 6.1.1
FROM ubuntu:20.04

# Copy the RTI Connext DDS installation from build context
COPY rti_connext_dds-6.1.1 /opt/rti_connext_dds-6.1.1/

# Set up the DDS execution environment
ENV NDDSHOME /opt/rti_connext_dds-6.1.1
ENV PATH $PATH:$NDDSHOME/bin

# Install the license file
COPY rti_license.dat /opt/rti_connext_dds-6.1.1

# Install the necessary build tools
RUN apt-get update && apt-get -y install build-essential              

Run the following command to build the image:

$ cd mybuild_eval
$ docker build -t dds-build-eval -f DockerfileEval .

Then you can use the dds-build-eval image just as you would use the dds-build image described in Creating the Build Image, above.

Using it as a base image

Once you have your Docker image with RTI Connext DDS in your local Docker registry you can use it as a baseline for building other images. For example:

# Use the Docker image with Connext as a base image. Use dds-build-eval instead
# if you are using an evaluation version of RTI Connext DDS.
FROM dds-build:latest

# Here you can install your apps or additional tools. For example:
RUN apt-get update && apt-get -y install vim      

Other Topics

For more examples of how to use Docker with RTI Connext DDS, search for “docker” at https://community.rti.com or https://blogs.rti.com.

Keywords:
Attachments: 

Comments

Hello, I am trying to follow this example but we are using Connext 6.1.0 in Ubuntu 18.04. Connext 6.1.0 only has the one .run file for both host and target. When I execute the run file I get stuck with an error where it will not execute unattached. Do you have any suggestions or updates to this?

Hi Raphael, it seems you are using an evaluation package. Evaluation packages are License Managed packages. Unfortunately, unattended mode (--mode unattended) is not available for License Managed packages. This is stated in Table 1.1 "Command-Line Options when Installing from a Script" from the Connext Installation Guide.
In order to create a Docker image for this kind of package, you will need to follow the process described under section "Variation: Evals" in this KB article. This means you will need to first install Connext locally on your operating system and then set up your Docker file so the whole installation is copied to the Docker image.

Where can I download the RTI Connext DDS host and target installation files?  I have a license, but need the files.

Never mind.  We already had them.