0

I'm trying to build docker image with Dockerfile. For the experiment, I added to this file such lines:

RUN ping google.com
RUN ping 8.8.8.8

Then I'm trying to build this image:

docker build -t my-custom-python:latest -f ./Dockerfile

And this code not working properly. For ping commands it says:

ping: bad address 'google.com'

If I remove this lines, then it executes command:

RUN pip wheel --wheel-dir=/wheels -r /requirements/dev.txt

it reads my requiremets/dev.txt file, sees such line:

git+git://github.com/bpython/bpython.git

And after this it says:

Running command git clone -q git://github.com/bpython/bpython.git /tmp/pip-req-build-o8c7n380 fatal: unable to look up github.com (port 9418) (Try again) ERROR: Command errored out with exit status 128: git clone -q git://github.com/bpython/bpython.git /tmp/pip-req-build-o8c7n380 Check the logs for full command output.

It seems there is a problem with DNS, and (as I noticed) it started when I install ExpressVPN. But in my host machine ping and git clone works.

I also tried to disable VPN - nothing changes. I don't know how to ckeck if DNS works insight Docker or how to fix it.

Please, need your help!

torek
  • 448,244
  • 59
  • 642
  • 775
  • 1
    Yes, you've somehow broken DNS in the Docker build process. Exactly how, I'm not sure. (This has nothing to do with Git, which should start working again when you fix the DNS issue.) – torek Mar 16 '22 at 23:08

1 Answers1

0

This post was very helpfull for me: My docker container has no internet

I changed resolv.conf on my host machine (Ubuntu 18.04):

sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

And after this, I recreated Docker configs:

pkill docker
iptables -t nat -F
ifconfig docker0 down
brctl delbr docker0
docker -d

Now, everything works fine.