How to configure spring boot web app with redis using Docker

╄→尐↘猪︶ㄣ 提交于 2020-01-15 03:45:06

问题


I have a small spring boot web application which saves the data to redis.

After running docker-compose.yml containers are started but on localhost:8085 i have "The connection was reset".

spring boot aplication.yml

server:
    address: 127.0.0.1
---
spring:
    profiles: development
server:
    address: 127.0.0.1
---
spring:
    profiles: production
server:
    address: 127.0.0.1

docker-compose.yml

web:
  build: docker_app
  ports:
   - "8085:8080"
  links:
   - redis

redis:  
    image: redis

How do I link spring boot and redis?

What did I miss?


回答1:


127.0.0.1 is the wrong address. Use redis as the hostname.



来源:https://stackoverflow.com/questions/35791179/how-to-configure-spring-boot-web-app-with-redis-using-docker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!