错误:无法在redis上连接到Redis:6379:名称或服务未知 [英] Error :Could not connect to Redis at redis:6379: Name or service not known

查看:120
本文介绍了错误:无法在redis上连接到Redis:6379:名称或服务未知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行名为 redis 的容器,该容器现在正在运行.但是错误无法在redis上连接到Redis:6379:名称或服务未知.任何人都请让我见鬼,找出问题并解决.

I am trying to execute the container named redis which is running right now.But the error Could not connect to Redis at redis:6379: Name or service not known. Any one please hell me to figure out the issue and fix it.

推荐答案

命名容器不会更改您的主机文件或DNS,并且取决于您运行容器的方式,它可能无法像Docker一样通过标准端口进行访问端口翻译.

Naming the container doesn't alter your hosts file or DNS, and depending on how you ran the container it may not be accessible via the standard port as Docker does port translation.

运行 docker inspect redis 并检查端口输出,它将告诉您可访问哪个端口以及IP.但是请注意,这只能通过该主机上的该IP进行连接.要从主机之外访问它,您将需要使用上述命令中的端口和主机的IP地址.前提是您的本地防火墙规则允许这样做,但这不在本网站的讨论范围之内.

Run docker inspect redis and examine the ports output, it will tell you what port it is accessible on as well as the IP. Note, however, that this will only be connectable over that IP from that host. To access it from off of the host you will need to use the port from the above command and the host's IP address. That assumes your local firewall rules allow it, which are beyond the scope of this site.

这篇关于错误:无法在redis上连接到Redis:6379:名称或服务未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆