【问题标题】:How to configure spring boot web app with redis using Docker如何使用 Docker 配置带有 redis 的 Spring Boot Web 应用程序
【发布时间】:2016-06-17 21:37:01
【问题描述】:

我有一个小型 Spring Boot Web 应用程序,可以将数据保存到 redis。

运行 docker-compose.yml 后,容器已启动,但在 localhost:8085 上我有“连接已重置”。

spring boot application.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

spring boot和redis如何链接?

我错过了什么?

【问题讨论】:

    标签: docker redis spring-boot docker-compose


    【解决方案1】:

    127.0.0.1 是错误的地址。使用redis 作为主机名。

    【讨论】:

    • 你是对的。我不能在 docker 和 redis 中使用地址 127.0.0.1 作为主机名。
    猜你喜欢
    • 2018-12-05
    • 2014-10-12
    • 1970-01-01
    • 2014-05-16
    • 1970-01-01
    • 2022-09-25
    • 2019-09-09
    • 2019-10-18
    • 2018-11-03
    相关资源
    最近更新 更多