Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

  • Setting DEBIAN_FRONTEND=noninteractive different ways based on the answers from Is it possible to answer dialog questions when installing under docker?
  • Setting DEBIAN_FRONTEND=teletype based on How to accept license agreement during docker build?
  • Using debconf-set-selections based on apt-get install without debconf prompt
    # echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
    # echo "rti-connext-dds-5.3.1 rti-connext-dds-5.3.1/license string y" | debconf-set-selections && \
    # echo "rti-connext-dds-5.3.1 rti-connext-dds-5.3.1/license string yes" | debconf-set-selections && \
    
  • Piping the yes command (this is worse, as I can't even abort with Ctrl+C)
    # apt-get install -y -q rti-connext-dds-5.3.1
    # yes "yes" | apt-get install -y -q rti-connext-dds-5.3.1
    

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

like image 559
Gino Mempin Avatar asked May 12 '19 14:05

Gino Mempin


2 Answers

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
like image 101
Irene Alejo Teissiere Avatar answered Nov 17 '22 17:11

Irene Alejo Teissiere


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

like image 1
Jeef Avatar answered Nov 17 '22 16:11

Jeef