【发布时间】:2021-05-17 08:30:32
【问题描述】:
我想将 Webbot 添加到我的 Dockerfile 中,但我遇到了问题。我目前的手动安装步骤(来自here)是:
$ # launch my Docker container without Webots
$ wget -qO- https://cyberbotics.com/Cyberbotics.asc | sudo apt-key add -
$ sudo apt update
$ sudo apt install -y software-properties-common
$ sudo apt-add-repository 'deb https://cyberbotics.com/debian/ binary-amd64/'
$ sudo apt update
$ sudo apt-get install webots
$ # now I have a Docker container with Webots
我想将此过程包含在 Docker 容器的构建中。不过,我不能只在Dockerfile 中使用相同的步骤,因为在安装 webbots 时,它会提示一些标准输入响应,询问键盘的原产国。由于 Docker 在构建时不听标准输入,所以我无法回答这些提示。我尝试像这样管道echo 输出,但它不起作用:
# Install Webots (a robot simulator)
RUN wget -qO- https://cyberbotics.com/Cyberbotics.asc | sudo apt-key add -
RUN apt-get update && sudo apt-get install -y \
software-properties-common \
libxtst6
RUN sudo apt-add-repository 'deb https://cyberbotics.com/debian/ binary-amd64/'
RUN apt-get update && echo 31 1 | sudo apt-get install -y \
webots # the echo fills the "keyboard country of origin" prompts
如何将 Webbot 包含在 Docker 容器中?我不想只使用别人的容器(例如cyberbotics/webots-docker),因为我需要在容器中添加其他东西,比如 ROS2。
【问题讨论】:
-
如Is it possible to answer dialog questions when installing under docker? 中所述设置
DEBIAN_FRONTEND=noninteractive有帮助吗? (这里根本不需要sudo;Dockerfile 应该默认以 root 身份运行。)
标签: docker dockerfile webots