鍍金池/ 問答/Linux/ docker容器中無法使用curl,報錯curl: (7) Connection

docker容器中無法使用curl,報錯curl: (7) Connection refused

使用的laradock夠建的docker環(huán)境,在進入Php-fmp容器中,使用curl命令直接報了錯,被拒絕掉了

root@30b704d009c1:/var/www# curl localhost
curl: (7) Failed to connect to docker.for.mac.localhost port 56137: Connection refused
root@30b704d009c1:/var/www# curl http://baidu.com
curl: (7) Failed to connect to docker.for.mac.localhost port 56137: Connection refused
root@30b704d009c1:/var/www

試過nginx,workspaec,127.0.0.1,外網(wǎng)地址,都是直接被拒絕,不知道是什么問題。

在容器外面是可以curl到容器的地址,但是就是在容量內(nèi)不能curl連接到容器地址。

回答
編輯回答
葬愛

親測有效,把域名host指向10.0.75.2

2018年6月21日 11:13
編輯回答
朕略傻

是laradock的問題,更新版本就好了。

2017年3月31日 19:58
編輯回答
檸檬藍

試下curl docker.for.mac.localhost,看下輸出。
我覺得是dockerfile寫的有問題,關(guān)于網(wǎng)絡(luò)配置這塊。

2018年1月12日 11:51