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:

FROM ubuntu:14.04.4
RUN echo 'deb HDP main' >> /etc/apt/sources.list.d/HDP.list
RUN echo 'deb HDP-UTILS main' >> /etc/apt/sources.list.d/HDP.list
RUN echo 'deb [arch=amd64] 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 HDP main' >> /etc/apt/sources.list.d/HDP.list ---> Using cache ---> bc23070c0b18
Step 3 : RUN echo 'deb HDP-UTILS main' >> /etc/apt/sources.list.d/HDP.list ---> Using cache ---> e45c32975e28
Step 4 : RUN echo 'deb [arch=amd64] 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.

I tried restarting docker, cleaning up all docker images, installing apt-transport-https, but nothing worked.

I dont know whats wrong here.

3

7 Answers

Because you have an https sources. Install apt-transport-https before executing update.

FROM ubuntu:14.04.4
RUN apt-get update && apt-get install -y apt-transport-https
RUN echo 'deb HDP main' >> /etc/apt/sources.list.d/HDP.list
RUN echo 'deb HDP-UTILS main' >> /etc/apt/sources.list.d/HDP.list
RUN echo 'deb [arch=amd64] trusty main' >> /etc/apt/sources.list.d/azure-public-trusty.list
....
Rest of your Dockerfile.
6

I had to clean up my disk with docker system prune, I did it because I read about it on this other SO answer

1

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:

RUN apt-get -y update

I encountered the same problem because my Dockerfile's FROM line refers to Ubuntu 20.10 whose support ended July 2021:

FROM ubuntu:groovy-20210416

Updating this to:

FROM ubuntu:focal-20211006

resolved the issue for me.

I had the same problem, solved it thanks to this answer :

You may want to add this line

RUN printf "deb jessie main\ndeb-src jessie main\ndeb jessie/updates main\ndeb-src jessie/updates main" > /etc/apt/sources.list

before any apt-get command in the Dockerfile.

in my case the error was

The repository ' Release' does not have a Release file.

adding [trusted=yes] before the deb package name fixed the issue.

i.e.

deb [trusted=yes] /

Had the same problem, fixed it using the following command

RUN apt -y update ; exit 0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like