[英](mac) dockers , how to connect to a redis server in the hosting machine from a containter
i am running a docker container on my mac machine using boot2docker
: 我正在使用
boot2docker
在mac机上运行boot2docker
:
I want to connect to redis-server
i am running my hosting machine from inside the container. 我想连接到
redis-server
我正在从容器内部运行主机。
curl http://192.168.3.124:5000
(getting results) curl http://192.168.3.124:5000
将容器从容器连接到正在主机上运行的服务(获取结果) redisServer = redis.StrictRedis(host='192.168.3.124', port= "6379"); redisServer.get("2") (gets no results, from the hosting machine that key is set)
details : running the redis server : 详细信息 :运行redis服务器:
[58781] 13 May 13:53:16.120 # Server started, Redis version 2.8.19
[58781] 13 May 13:53:16.120 * DB loaded from disk: 0.000 seconds
[58781] 13 May 13:53:16.120 * The server is now ready to accept connections on port 6379
ps aux |grep redis
partuck 58781 0.0 0.0 2469924 1652 s002 S+ 1:53PM 0:00.03 redis-server *:6379
partuck 58728 0.0 0.7 2583104 115260 ?? S 1:53PM 0:00.47 /usr/local/opt/redis/bin/redis-server 127.0.0.1:6379
from the 来自
Your host IP in the virtualbox that boot2docker setups is (typically) 10.0.2.2. 您在boot2docker设置的虚拟机中的主机IP(通常为10.0.2.2)。
So you should try connecting to 10.0.2.2:6379 因此,您应该尝试连接到10.0.2.2:6379
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.