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

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:

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

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

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.

Could it be a proxy issue then?

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

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

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

1 Like