(mac)docker工人,如何从托pipe人连接到主机中的redis服务器

我正在使用boot2docker在我的mac机器上运行boot2docker

我想连接到redis-server我正在容器内运行我的主机。

  1. 我设法从容器连接到我在主机上运行的服务使用curl http://192.168.3.124:5000 (获取结果)
  2. 我设法连接到它,但我不是根据它的状态从它的数据。 redisServer = redis.StrictRedis(host='192.168.3.124', port= "6379"); redisServer.get("2") (gets no results, from the hosting machine that key is set)

详细信息 :运行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 

来自

您的主机IP位于boot2docker设置(通常为)10.0.2.2的虚拟机中。

所以你应该尝试连接到10.0.2.2:6379