Docker Community Forums

Share and learn in the Docker community.

Unable to apt-get update in Node-Red docker image


(Dielenb) #1

I’ve built several Node-red docker images before without issue. Now I have a problem where I’m unable to use “apt-get update” in my Dockerfile.

The step always fails with error:

E: The method driver /usr/lib/apt/methods/https could not be found.
The command ‘/bin/sh -c apt-get update && apt-get install libaio1’ returned a non-zero code: 100

Does anyone have an idea? Installing https package is not possible because apt-get is not working first… a bit of the egg/chicken story… :slight_smile:


(Ove "Lime" Lindström) #2

The apt-get needs to have root privileges to the to write in the /var/lib/apt/lists/partial so you need to switch to the user root to install those.

This seems to work.

FROM nodered/node-red-docker
USER root
RUN apt-get update
RUN apt-get install -y apt-utils libaio1
USER node-red

(Dielenb) #3

Unfortunately I already did that in the Dockerfile:

get latest node-red image from docker hub

from nodered/node-red-docker:latest

switch to root user and set environment variables

USER root
ENV http_proxy=http://172.17.0.1:3128/
ENV https_proxy=http://172.17.0.1:3128/
ENV HTTP_PROXY=http://172.17.0.1:3128/
ENV HTTPS_PROXY=http://172.17.0.1:3128/

install libaio1 dependency

RUN apt-get update && apt-get install libaio1


(Ove "Lime" Lindström) #4

This indicates a timeout. Try using apt-get update && apt-get install -y libaio1 the same way as I did it in the example above. Always use the headless flag when running things in a Dockerfile.


(Dielenb) #5

Could it be a proxy issue then?


(Ove "Lime" Lindström) #6

Have you tried building it with the -y headless flag??


(Dielenb) #7

Yes, it’s actually the “apt-get update” that already fails.


(Dielenb) #8

This seems to be a proxy issue, as the Dockerfile succesfully builds in the sandbox environment at labs.play-with-docker.com