[Django]-Docker build network error when trying to pip install

8👍

Ok, we can try a couple of things. First thing I would do:

  • In the Dockerfile add this(with google’s dns):

RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf && pip install pipenv && pipenv install --system

It is important to do in the same RUN command.

  • Another option is:

docker build --network=host -t yourimage:yourversion .

0👍

I had the same issue last night – and this morning. Even after rebooting and trying to stop/start the service. This is on my Windows 10.

I did notice running a docker info output the following error:

Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified

As detailed here – https://stackoverflow.com/a/74098179/405022

Having ran wsl --shutdown and being prompted to restart docker desktop, I then proceeded to try my docker build.

docker build -f ./sources/service1/deploy/dev.dockerfile ./sources/service1 -t acme-app.service1-py:latest --no-cache --progress=plain

Coincidence? It worked for me in the end.

👤Andez

Leave a comment