[英]apt-get update' returned a non-zero code: 100
I am trying to create a docker image from my docker file which has the following content:我正在尝试从我的 docker 文件创建一个 docker 图像,该文件具有以下内容:
FROM ubuntu:14.04.4
RUN echo 'deb http://private-repo-1.hortonworks.com/HDP/ubuntu14/2.x/updates/2.4.2.0 HDP main' >> /etc/apt/sources.list.d/HDP.list
RUN echo 'deb http://private-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/ubuntu14 HDP-UTILS main' >> /etc/apt/sources.list.d/HDP.list
RUN echo 'deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/azurecore/ trusty main' >> /etc/apt/sources.list.d/azure-public-trusty.list
RUN gpg --keyserver pgp.mit.edu --recv-keys B9733A7A07513CAD
RUN gpg -a --export 07513CAD | apt-key add -
RUN gpg --keyserver pgp.mit.edu --recv-keys B02C46DF417A0893
RUN gpg -a --export 417A0893 | apt-key add -
RUN apt-get update
which fails with the following error:失败并出现以下错误:
root@sbd-docker:~/ubuntu# docker build -t hdinsight .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM ubuntu:14.04.4
---> 8f1bd21bd25c
Step 2 : RUN echo 'deb http://private-repo-1.hortonworks.com/HDP/ubuntu14/2.x/updates/2.4.2.0 HDP main' >> /etc/apt/sources.list.d/HDP.list
---> Using cache
---> bc23070c0b18
Step 3 : RUN echo 'deb http://private-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/ubuntu14 HDP-UTILS main' >> /etc/apt/sources.list.d/HDP.list
---> Using cache
---> e45c32975e28
Step 4 : RUN echo 'deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/azurecore/ trusty main' >> /etc/apt/sources.list.d/azure-public-trusty.list
---> Using cache
---> 1659cdcab06e
Step 5 : RUN gpg --keyserver pgp.mit.edu --recv-keys B9733A7A07513CAD
---> Using cache
---> ca73b2bfcd21
Step 6 : RUN gpg -a --export 07513CAD | apt-key add -
---> Using cache
---> 95596ad10bc9
Step 7 : RUN gpg --keyserver pgp.mit.edu --recv-keys B02C46DF417A0893
---> Using cache
---> f497deeef5b5
Step 8 : RUN gpg -a --export 417A0893 | apt-key add -
---> Using cache
---> d01dbe7fa02e
Step 9 : RUN apt-get update
---> Running in 89d75799982f
E: The method driver /usr/lib/apt/methods/https could not be found.
The command '/bin/sh -c apt-get update' returned a non-zero code: 100
root@sbd-docker:~/ubuntu#
I am running this on Ubuntu 14.04.4
.我在
Ubuntu 14.04.4
上运行它。
I tried restarting docker, cleaning up all docker images, installing apt-transport-https
, but nothing worked.我尝试重新启动 docker,清理所有 docker 图像,安装
apt-transport-https
,但没有任何效果。
I dont know whats wrong here.我不知道这里有什么问题。
Because you have an https sources.因为你有一个 https 来源。 Install
apt-transport-https
before executing update.在执行更新之前安装
apt-transport-https
。
FROM ubuntu:14.04.4
RUN apt-get update && apt-get install -y apt-transport-https
RUN echo 'deb http://private-repo-1.hortonworks.com/HDP/ubuntu14/2.x/updates/2.4.2.0 HDP main' >> /etc/apt/sources.list.d/HDP.list
RUN echo 'deb http://private-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/ubuntu14 HDP-UTILS main' >> /etc/apt/sources.list.d/HDP.list
RUN echo 'deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/azurecore/ trusty main' >> /etc/apt/sources.list.d/azure-public-trusty.list
....
Rest of your Dockerfile.
我不得不用docker system prune
清理我的磁盘,我这样做是因为我在另一个SO 答案中读到了它
Just adding this in case it's of use to someone else.只是添加它以防它对其他人有用。 In my case I had to add the following line to the
Dockerfile
:在我的情况下,我必须
Dockerfile
添加到Dockerfile
:
RUN apt-get -y update
I had the same problem, solved it thanks to this answer :我遇到了同样的问题,通过这个答案解决了它:
https://superuser.com/questions/1423486/issue-with-fetching-http-deb-debian-org-debian-dists-jessie-updates-inrelease/1424377 https://superuser.com/questions/1423486/issue-with-fetching-http-deb-debian-org-debian-dists-jessie-updates-inrelease/1424377
You may want to add this line您可能想添加这一行
RUN printf "deb http://archive.debian.org/debian/ jessie main\ndeb-src http://archive.debian.org/debian/ jessie main\ndeb http://security.debian.org jessie/updates main\ndeb-src http://security.debian.org jessie/updates main" > /etc/apt/sources.list
before any apt-get
command in the Dockerfile.在 Dockerfile 中的任何
apt-get
命令之前。
in my case the error was在我的情况下,错误是
The repository 'http://internalrepo/repos/internalrepo-name/1 Release' does not have a Release file.
存储库“http://internalrepo/repos/internalrepo-name/1 Release”没有发布文件。
adding [trusted=yes] before the deb package name fixed the issue.在 deb 包名称之前添加 [trusted=yes] 修复了该问题。
ie IE
deb [trusted=yes] http://internalrepo/repos/internalrepo-name/1 /
Had the same problem, fixed it using the following command有同样的问题,使用以下命令修复它
RUN apt -y update ;
运行 apt -y 更新; exit 0
退出 0
I encountered the same problem because my Dockerfile
's FROM
line refers to Ubuntu 20.10 whose support ended July 2021:我遇到了同样的问题,因为我的
Dockerfile
的FROM
行指的是 Ubuntu 20.10,其支持于 2021 年 7 月结束:
FROM ubuntu:groovy-20210416
Updating this to:将此更新为:
FROM ubuntu:focal-20211006
resolved the issue for me.为我解决了这个问题。
Check your time settings.检查您的时间设置。
They may be not in sync with target http|https repository.它们可能与目标 http|https 存储库不同步。
Based on @Jonathan Morales Vélez 's answer (running out of disk space), the following command helped me to reclaim disk space:根据@Jonathan Morales Vélez 的回答(磁盘空间不足),以下命令帮助我回收磁盘空间:
docker image prune -f
Afterwards the Docker Image build resumed working.之后 Docker 映像构建恢复工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.