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:
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:
DEBIAN_FRONTEND=noninteractive
different ways based on the answers from Is it possible to answer dialog questions when installing under docker?DEBIAN_FRONTEND=teletype
based on How to accept license agreement during docker build?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 && \
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?
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