How to accept the license agreement when building rti-connext-dds-5.3.1 with docker build?
Asked Answered
P

2

6

I am building an image from a Dockerfile that needs to install the package rti-connext-dds-5.3.1. (It's one of the dependencies when building ROS2 on Linux).

The problem with that package is that it displays a license agreement that must be scrolled-down and then accepted by entering "yes" on the prompt. I cannot seem to set up the Dockerfile commands to auto-scroll and/or auto-accept this license agreement:

license agreement

Pressing the Enter or Space key does not scroll the license down, it just displays blank lines. Pressing any other key/s just prints it out to the console. At this point, the build is stuck, and it can't proceed.

Here is the Dockerfile:

FROM ubuntu:bionic

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y apt-utils debconf-utils gnupg2 lsb-release && \
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116 && \
    echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros2-latest.list && \
    apt-get update && \
    apt-get install -y rti-connext-dds-5.3.1

WORKDIR /home

I already tried:

How do I auto-scroll and/or auto-accept the license during installation?

Puttyroot answered 12/5, 2019 at 14:31 Comment(2)
The regular RTI installer has a --mode unattended commandline flag to install and automatically accept the license, maybe try to pass that?Approbation
@JohnnyWillemsen I am installing it via apt-get, and I don't think there is a way to pass --mode.Puttyroot
P
7

You can use the env variable "RTI_NC_LICENSE_ACCEPTED=yes". Your dockerfile will look something like this:

FROM ubuntu:bionic

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y apt-utils debconf-utils gnupg2 lsb-release && \
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116 && \
    echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros2-latest.list && \
    apt-get update 
RUN RTI_NC_LICENSE_ACCEPTED=yes apt-get install rti-connext-dds-5.3.1

WORKDIR /home
Piscina answered 13/5, 2019 at 8:38 Comment(1)
That did the trick. It also works when putting ARG RTI_NC_LICENSE_ACCEPTED=yes right before the RUN commands, so that everything is still in one RUN command.Puttyroot
P
1

This is a valid answer but def not the best one. I'm currently using the trial version of DDS which does NOT allow you to automatically accept the license. So my work around was to do the following:

First I installed the expect command which allows you to write scripts that will interact and say hit enter 21 times and then the letter y etc.

Additionally there is a command called autoexpect that will generate a script for you. So my steps are:

  1. Launch a basic container and copy over rti_connext_dds-6.0.1-eval-x64Linux4gcc7.3.0.run - or mount the file locally

  2. Run autoexpect ./rti_connext_dds-6.0.1-eval-x64Linux4gcc7.3.0.run which will generate script1.exp.

  3. Now build an actual container that copies over the install file as well as the expect script and do the following:

ARG RTI_INSTALL_FILE=rti_connext_dds-6.0.1-eval-x64Linux4gcc7.3.0.run
RUN chmod +x /rti/${RTI_INSTALL_FILE} && expect /rti/script.exp

The best path - of course - is to do what was suggested above - however - to know more about docker expect is a great little hack

Pelota answered 2/4, 2021 at 19:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.