网站首页

docker下php容器 curl本机无法访问【curl: (7) Failed to connect to x.x.x.x port 80: Host is unreachable)】

中文Lee 2021/11/11 4998人围观
PHP   linux   docker  

问题描述:

centos 7.9 服务器上 使用docker容器部署了php环境,但是使用curl的时候 ,访问其他机器ip正常,但是curl本机ip 出现 curl: (7) Failed to connect to x.x.x.x port 80: Host is unreachable)的错误,经过几番折腾,各种技术论坛,百度等搞了好久终于找到了解决方案,解决方案如下:

执行如下两行命令即可解决问题

firewall-cmd --permanent --zone=trusted --change-interface=docker0
firewall-cmd --reload

相关推荐