试图创建自定义Docker映像,但在运行步骤中被询问问题

2024-04-19 17:57:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试创建一个自定义Docker映像,在RUN的一个步骤中,我被要求选择一些“菜单”选项。。这会挂起/阻止图像继续/制作

以下是Dockerfile:

FROM ubuntu:latest

RUN apt update

# install OpenCV
RUN apt install python3-opencv -y

# Test that OpenCV has been installed
RUN python3 -c "import cv2; print(cv2.__version__)"

以下是构建输出中的最后几行:

....
Setting up libsnappy1v5:amd64 (1.1.8-1build1) ...
Setting up poppler-data (0.4.9-2) ...
Setting up libkrb5support0:amd64 (1.17-6ubuntu4) ...
Setting up libsasl2-modules-db:amd64 (2.1.27+dfsg-2) ...
Setting up tzdata (2020a-0ubuntu0.20.04) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring tzdata
------------------

Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.

  1. Africa      4. Australia  7. Atlantic  10. Pacific  13. Etc
  2. America     5. Arctic     8. Europe    11. SystemV
  3. Antarctica  6. Asia       9. Indian    12. US
Geographic area: 

这是第三步的一部分=>RUN p3 p3-opencv

我怎样才能使这一步自动完成?我猜在尝试安装python-opencv时,我缺少依赖项和/或需要更新某些依赖项。这很好,它正在尝试更新/安装这些,但需要一些用户交互


Tags: installthetorunaptcv2settingopencv
1条回答
网友
1楼 · 发布于 2024-04-19 17:57:08

您可以使用DEBIAN_FRONTEND=noninteractive

FROM ubuntu:latest
RUN apt update
ENV DEBIAN_FRONTEND=noninteractive

# install OpenCV
RUN apt install python3-opencv -y

# Test that OpenCV has been installed
RUN python3 -c "import cv2; print(cv2.__version__)"

相关问题 更多 >