jzoric
jzoric

Reputation: 227

How to configure spring boot web app with redis using Docker

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?

Upvotes: 3

Views: 2723

Answers (1)

dnephin
dnephin

Reputation: 28120

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

Upvotes: 3

Related Questions