3

I have set up a docker container.The container i got from dockerhub and installed it using

docker pull gilbitron/php5.6-mysql

I ran the container but i cant clone from git

 root@b5ff858016a9:/var/www/html# git clone https://github.com/person/project.git
    Cloning into 'bloodbank'...
    fatal: unable to access 'https://github.com/person/project.git': Could not resolve host: github.com
sivan
  • 57
  • 1
  • 6

1 Answers1

0

That means the DNS is not working from within your container.

Try, as in "Network calls fail during image build on corporate network", to add the dns network setting to your docker run command

 docker run --dns 10.0.0.2 <image_name> bash

Replace "10.0.0.2" by your DNS IP (ipconfig --all or ipconfig /a on PC.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • CentOS 8 : i had to try changing daemon.json multiple times, as in other links, 8.8.8.8 wasn't working for me as default DNS, the IP from cat /etc/resolv.conf worked - also needed to add rule to firewalld and forgot to restart it afterwards - don't know if that was the culprit. – hello_earth Sep 16 '20 at 09:09
  • and once more, the useful link : https://docs.docker.com/engine/install/linux-postinstall/ – hello_earth Sep 16 '20 at 09:11