简体   繁体   中英

Inside docker got error as fatal: unable to access <url> Could not resolve host: github.com

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM