Deploying an RTI Connext DDS Application with Docker

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, visit and get up to speed on Docker basics before reading further.


In this example, we’ll build and deploy a complete RTI Connext DDS application using Docker. We’ll use Ubuntu 16.04 (x64) for the target operating system and assume that the host is also using a Linux* OS.

You should already have a Docker image for building DDS applications. (For instructions on how to create this image, see Creating a Docker image with RTI Connext DDS.) We’ll assume this image is named dds-build. We’ll use  dds-build to build our application. Then we’ll create a new docker image, named myapp-deploy, that holds the compiled application. This image will be relatively small because it contains only the Linux image and the final application.

After we build the myapp-deploy image, we’ll run it in two different containers and see that the applications communicate successfully.

Let’s get started!

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

Building an App

We’ll begin by using the dds-build image to generate and compile an example application.  Our application uses a simple IDL file, named Values.idl.

struct Values {
    unsigned long num;

Create a new directory, such as myapp, and add Values.idl to this directory.  We’ll use rtiddsgen to generate example code from this IDL.  Change directory to myapp (if not already there) and run the following command to generate example code based on Values.idl:

$ docker run -it --rm -v `pwd`:/app -w="/app" dds-build \
    rtiddsgen Values.idl -ppDisable -language C \
    -create typefiles -create examplefiles -create makefiles \
    -platform x64Linux3gcc5.4.0

This command starts a container using the dds-build image and runs the rtiddsgen utility (from the image) in the container.  The rtiddsgen utility operates on the myapp directory mounted at /app in the container.

The myapp directory should now contain several more files, including type files, an example publisher, and an example subscriber.  Compile the code using the following command:

$ docker run -it --rm -v `pwd`:/app -w="/app" dds-build \
    make -f makefile_Values_x64Linux3gcc5.4.0

Similar to above, this command runs make on the myapp directory, mounted at /app, all inside a container running the dds-build image.

The compiled applications are now located in myapp/objs/x64Linux3gcc5.4.0.

Creating a Deployment Image

One of the key ideas behind Docker is to bundle an application with everything it needs to run.  We can then easily deploy the application in a variety of environments without having to worry about dependencies.

Now we’ll create a “deployment” Docker image that encapsulates the test applications we just created.  We’ll use a single image to hold the publisher and subscriber applications, but you could put them in separate images.

As above, we need a dockerfile for constructing the new image.  Create the file in your myapp directory and name it Dockerfile.  It is a fairly simple recipe:

FROM ubuntu:16.04

# Store the test apps in /app 

# Copy the apps and QoS file
    objs/x64Linux3gcc5.4.0/Values_publisher \
    objs/x64Linux3gcc5.4.0/Values_subscriber \
    rti_license.dat \

# Add the apps to the PATH

This recipe assumes you have a license file named rti_license.dat and that you’ve placed it in the myapp directory.  This will include your license in the deployment image and place it in the working directory of your applications, where RTI Connext DDS will automatically look for it.  Note that if you do not need a license to run your version of RTI Connext DDS, you can leave out the license file.  Also note that if you build your application with shared libraries, the deployment image must also include the target libraries from your RTI Connext DDS installation.

Run the following docker command in the myapp directory to build the image:

$ docker build -t myapp-deploy .

The local Docker registry now has an image named myapp-deploy.  This image contains everything needed to run the publisher and subscriber example applications.

Running the Apps

To keep this example simple, we’ll run the subscriber and publisher on the same machine and use the “bridge” network.  

To start the subscriber application, run:

$ docker run --rm --network=bridge -it myapp-deploy Values_subscriber

To start the publisher, run:

$ docker run --rm --network=bridge -it myapp-deploy Values_publisher

The subscriber should receive the publisher’s samples.

You can use the docker container ls and docker container stop commands to list the container IDs and stop the applications.

Congratulations!  You’ve just successfully compiled and deployed an RTI Connext DDS application using Docker.

Other Topics

For more examples of how to use Docker with RTI Connext DDS, search for “docker” at or