Question
i can't install any package during building an image. pulling from docker hub is OK, but problems occurred when docker try to use network to build an image. for example, if i try to run:
$ docker build -t sample-image:latest .
... and the Dockerfile that used by above command has following line:
RUN pip install -r requirements.txt
... then i get next error:
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fdbe102e278>: Failed to establish a new connection: [Errno -2] Name or service not known',)': /simple/sanic/
Could not find a version that satisfies the requirement sanic (from -r requirements.txt (line 1)) (from versions: )
No matching distribution found for sanic (from -r requirements.txt (line 1))
... the same error appear when ubuntu packages are updating
Info
docker and docker compose installed by official docker's documentation (without any changes).
Server Version: 17.03.1-ce
Storage Driver: aufs
Kernel Version: 4.8.0-45-generic
Operating System: Ubuntu 16.04.2 LTS
Architecture: x86_64
CPUs: 2
Total Memory: 3.763 GiB
requirements.txt:
sanic
asyncpg
asyncio
uvloop
Dockerfile:
FROM python:3.5-onbuild
WORKDIR /usr/src/app
# https://github.com/vishnubob/wait-for-it
CMD ["./run/wait-for-it.sh", "db:5432", "--", "python", "index.py"]
P.S.
i test more decisions and none helped yet. thanks for help everyone :)