我的码头工人的版本是1.13.1。 我尝试连接到Redis的服务器从我的搬运工容器,但我得到拒绝连接error.Detailed日志如下:
redis.clients.jedis.exceptions.JedisConnectionException:通过引起java.net.ConnectException:连接被拒绝在redis.clients.jedis.Connection.connect(Connection.java:207)[jedis-2.9.0.jar:]在redis的.clients.jedis.BinaryClient.connect(BinaryClient.java:93)[jedis-2.9.0.jar:]在redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1767)[jedis-2.9.0.jar :]在redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:106)[jedis-2.9.0.jar:]在org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:888) [公地pool2-2.4.3.jar:2.4.3]在org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:432)[公地pool2-2.4.3.jar:2.4.3 ]在org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:361)[公地pool2-2.4.3.jar:2.4.3]在redis.clients.util.Pool.getResource(池。的java:49)[jedis-2.9.0.jar:]:java.net.ConnectException:... 27更由导致连接拒绝在java.net.PlainSocketImpl.socketConn ECT(本机方法)[rt.jar中:1.7.0_80]在java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)[rt.jar中:1.7.0_80]在java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java :200)[rt.jar中:1.7.0_80]在java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)[rt.jar中:1.7.0_80]在java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392 )[rt.jar中:1.7.0_80]在java.net.Socket.connect(Socket.java:579)[rt.jar中:1.7.0_80]在redis.clients.jedis.Connection.connect(Connection.java:184 )[jedis-2.9.0.jar:] ... 34更
当我给--net="host"
选项消失了这个错误,但是当我给
--add-host=parent-host:`ip route show | grep docker0 | awk '{print \$9}'`
我得到的错误,虽然容器是能够连接到数据库在不同的虚拟机,但没有连接到Redis的服务器现在的自己托管的机器上。