使用 Ubuntu 18.04 映像进行 docker 构建在提示输入键盘原产国后挂起

Dea*_*lze 11 build docker ubuntu-18.04

当我使用 docker 构建 Ubuntu 18.04 映像时,它会提示

键盘原产国:

当我输入一个数字后它就会挂起。这是我的 Dockerfile:

FROM ubuntu:18.04

RUN apt update
RUN apt install software-properties-common -y
RUN add-apt-repository ppa:graphics-drivers 
RUN apt install nvidia-driver-440 -y
Run Code Online (Sandbox Code Playgroud)

我需要做什么才能使用 Docker 构建 ubuntu 18.04 映像?

Neo*_*son 14

如果设置此环境变量,则可以跳过该交互式输入:DEBIAN_FRONTEND=noninteractive

Dockerfile 应如下所示:

FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install software-properties-common -y
RUN add-apt-repository ppa:graphics-drivers
RUN apt install nvidia-driver-440 -y
Run Code Online (Sandbox Code Playgroud)

  • 对于层缓存目的,在同一个“RUN”指令中执行“apt-get update && apt-get install”也很重要,我通常仅在单个“RUN”行中设置“DEBIAN_FRONTEND”,以避免它泄漏到图像的其余部分。 (3认同)