从 Dockerfile apt-get install 返回非零代码 100

问题描述 投票:0回答:2

我有一个 Dockerfile,我想在我的机器上安装 ffmpeg。但是,Dockerfile 总是以以下错误结束:

Sending build context to Docker daemon  3.371GB
Step 1/22 : FROM nvcr.io/nvidia/deepstream:6.0.1-devel
 ---> b8179aaa2d73
Step 2/22 : RUN apt-get update && apt-get upgrade -y
 ---> Running in 57df65265677
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  Could not resolve 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease              
  Could not resolve 'security.ubuntu.com'
Err:3 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease
  Could not resolve 'developer.download.nvidia.com'
Err:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease                
  Could not resolve 'archive.ubuntu.com'
Err:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  Could not resolve 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease  Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease  Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease  Could not resolve 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease  Could not resolve 'security.ubuntu.com'
W: Failed to fetch https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/InRelease  Could not resolve 'developer.download.nvidia.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  cuda-libraries-11-4 cuda-libraries-dev-11-4 libcublas-11-4
  libcublas-dev-11-4 libnccl-dev libnccl2 libnvinfer-dev libnvinfer-plugin-dev
  libnvinfer-plugin8 libnvinfer8 libnvonnxparsers-dev libnvonnxparsers8
  libnvparsers-dev libnvparsers8 python3-libnvinfer python3-libnvinfer-dev
The following packages will be upgraded:
  base-files ca-certificates cuda-command-line-tools-11-4 cuda-compat-11-4
  cuda-compiler-11-4 cuda-cudart-11-4 cuda-cudart-dev-11-4
2 upgraded, 0 newly installed, 0 to remove and 16 not upgraded.
Need to get 1325 MB of archives.
After this operation, 51.2 MB disk space will be freed.
Err:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  cuda-nvdisasm-11-4 11.4.152-1
  Could not resolve 'developer.download.nvidia.com'
Err:2 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  cuda-nvtx-11-4 11.4.120-1
  Could not resolve 'developer.download.nvidia.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/b/base-files/base-files_10.1ubuntu2.11_amd64.deb  Could not resolve 'archive.ubuntu.com'
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/s/shadow/login_4.5-1ubuntu2.2_amd64.deb  Could not resolve 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get update && apt-get upgrade -y' returned a non-zero code: 100

我已经尝试寻找错误但找不到好的解决方案。 Dockerfile 如下所示:

FROM nvcr.io/nvidia/deepstream:6.0.1-devel

#Set environment variables
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get upgrade -y
RUN apt-get install ffmpeg -y

有人知道错误可能出在哪里吗?代码似乎有“nointerarctive”环境变量的问题。因为他做的一切都是正确的,直到他需要升级软件包。

docker ubuntu dockerfile apt apt-get
2个回答
0
投票

你有尝试过改变吗

ENV DEBIAN_FRONTEND noninteractive

ENV DEBIAN_FRONTEND=noninteractive

另外,请阅读此处 为什么在 Docker 文件中不鼓励使用 DEBIAN_FRONTEND=noninteractive ?


0
投票

我也有同样的问题。 当我同步时间时一切都开始工作(在错误之前)

© www.soinside.com 2019 - 2024. All rights reserved.