我正在尝试从我的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
哪个失败并出现以下错误
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#
我在Ubuntu 14.04.4上运行它
我尝试重新启动docker,清理所有docker镜像,安装apt-transport-https
但没有任何效果。
我不知道这里有什么不对。
答案 0 :(得分:33)
因为您有https来源。在执行更新之前安装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.
答案 1 :(得分:1)
我不得不用docker system prune
清理磁盘,之所以这么做是因为我在另外SO answer上读过它
答案 2 :(得分:0)
我遇到了同样的问题,这要归功于这个答案:
您可能要添加此行
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
在Dockerfile中的任何api-get
命令之前。
答案 3 :(得分:0)
就我而言,错误是
The repository 'http://internalrepo/repos/internalrepo-name/1 Release' does not have a Release file.
在 deb 包名称前添加 [trusted=yes] 修复了问题。
即
deb [trusted=yes] http://internalrepo/repos/internalrepo-name/1 /
答案 4 :(得分:0)
只是添加这个以防对其他人有用。就我而言,我必须将以下行添加到 Dockerfile
:
RUN apt-get -y update