linux - pip install doesn't work correctly in docker -


question

i can't install package during building image. pulling docker hub ok, problems occurred when docker try use network build image. example, if try run:

$ docker build -t sample-image:latest . 

... , dockerfile used above command has following line:

run pip install -r requirements.txt 

... next error:

retrying (retry(total=4, connect=none, read=none, redirect=none)) after connection broken 'newconnectionerror('<pip._vendor.requests.packages.urllib3.connection.verifiedhttpsconnection object @ 0x7fdbe102e278>: failed establish new connection: [errno -2] name or service not known',)': /simple/sanic/  not find version satisfies requirement sanic (from -r requirements.txt (line 1)) (from versions: ) no matching distribution found sanic (from -r requirements.txt (line 1)) 

... same error appear when ubuntu packages updating


info

docker , docker compose installed official docker's documentation (without 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 , none helped yet. :)

thanks salem! following decision helped me:

try edit /etc/networkmanager/networkmanager.conf , comment out dns=dnsmasq part, restart network , docker , try again


Comments