1,182
社区成员




RT,环境是windows10,redis是使用容器部署的,其中的主要配置如下:
bind 0.0.0.0
protected-mode no
port 6379
requirepass 111111
当使用intellij开发的时候,运行都OK,增删改查都没有问题。
现在将程序发布到docker for windows上面了,程序运行除了连接redis容器的函数出错之后,其它都OK。
当连接redis容器的时候出现如下错误:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: redis.clients.jedis.exceptions.JedisConnectionException: Failed to connect to any host resolved for DNS name.] with root cause
2023-05-15 10:22:17
2023-05-15 10:22:17 redis.clients.jedis.exceptions.JedisConnectionException: Failed to connect to any host resolved for DNS name.
也尝试过将容器加入同一个docker network中,但是还是出现相同的问题,请大神不吝赐教!
问题解决了,可以使用 --link将2个container加载入同一个network,但是这个时候,使用要使用container的原生port,不能使用容器的映射port