Ticoincoin
Ticoincoin

Reputation: 209

Docker Image build fails when installing libraries: Failed to establish a new connection: [Errno -5] No address associated with hostname

I have a Dockerfile that I use to build an environment for my application backend. It used to work fine. Then I needed an additional library (openpyxl), so I added it to the list of libraries to be installed, in Dockerfile.

I tried to build the image again, and now it fails to install any library because of a connection error:

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f1710fc4828>: Failed to establish a new connection: [Errno -5] No address associated with hostname',)': /simple/numpy/
  Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy

This is the beginning of the Dockerfile:

# VERSION 0.2

FROM ubuntu:18.04

RUN useradd -ms /bin/bash ubuntu

# Define or terminal will complain if no ascii char come around
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt install -y tzdata
RUN apt-get install -y locales net-tools
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8

## usefull command
RUN apt update && apt install -y zip unzip wget curl

## first line needed or open cv will complain
RUN apt update && apt install -y libsm6 libxext6 libxrender-dev &&\
    apt-get update && apt-get install -y python3-pip &&\
    apt-get update && pip3 install --upgrade pip

## libpq-dev needed to install psycopg2
RUN apt-get install -y libpq-dev && pip3 install \
        numpy pandas==1.0.5 xlrd \
        Pillow==8.1.0 opencv-python albumentations \
        flask==1.1.2 flask-cors==3.0.10 flask-basicauth==0.2.0 flask-sqlalchemy==2.5.1 requests gunicorn==20.0.4 celery\
        path.py==12.5.0 pytest \
        unidecode==1.2.0 \
        psycopg2==2.7.7 sqlalchemy==1.3.0 Flask-Migrate==2.7.0\
        jupyter openpyxl

Any idea xhat could cause this error? Thanks

Upvotes: 2

Views: 1689

Answers (2)

Toren Darby
Toren Darby

Reputation: 71

I had this error until I disabled dns-over-https.

If you have WARP or something similar enabled, try toggling it off.

Upvotes: 0

Johnny
Johnny

Reputation: 694

This is because NumPy has timed out four times.

Install with -i https://pypi.mirrors.ustc.edu.cn/simple/

Use a correct mirrors.This may be the right one for me.

apt-get install -y libpq-dev && pip3 install numpy pandas==1.0.5 \
    xlrd Pillow==8.1.0 opencv-python albumentations flask==1.1.2 \
    flask-cors==3.0.10 flask-basicauth==0.2.0 flask-sqlalchemy==2.5.1 \
    requests gunicorn==20.0.4 celery path.py==12.5.0 pytest unidecode==1.2.0 \
    psycopg2==2.7.7 sqlalchemy==1.3.0 Flask-Migrate==2.7.0 \
    jupyter openpyxl -i https://pypi.mirrors.ustc.edu.cn/simple/

Upvotes: 1

Related Questions