0

我的 docker-compose 配置存在无法确定的问题:redis 无法启动。

的 docker-compose.yml

web:
  build: ./web
  links:
   - db
   - redis
  ports:
   - "8080:8080"
db:
  image: mysql
  ports:
    - "3307:3306"
  environment:
    MYSQL_ROOT_PASSWORD: root
    MYSQL_DATABASE: bignibou_dev
redis:
  build: ./redis
  ports:
    - "63790:6379"

我的./web/Dockerfile

FROM java:8
ADD ./bignibou-server-1.0.jar /app/bignibou-server-1.0.jar
ADD ./spring-cloud.properties /app/spring-cloud.properties
ENV SPRING_CLOUD_PROPERTIESFILE=/app/spring-cloud.properties
ENV SPRING_PROFILES_ACTIVE=cloud
ENV SPRING_CLOUD_APP_NAME=bignibou
ENV CLEARDB_DATABASE_URL=mysql://root:root@localhost:3307/bignibou_dev
ENV REDISCLOUD_URL=redis://dummy:dummy@localhost:63790
ENV DYNO=dummy
EXPOSE 8080
ENTRYPOINT [ "java", "-jar", "/app/bignibou-server-1.0.jar" ]

我的./redis/Dockerfile

FROM redis
COPY redis.conf /usr/local/etc/redis/redis.conf
EXPOSE 6379
ENTRYPOINT [ "redis-server", "/usr/local/etc/redis/redis.conf" ]

当我运行时sudo docker-compose up,尽管mysql/db正常启动,但 Docker 并未启动redis

有人可以帮忙吗?

4

1 回答 1

0

而不是 localhost ,写你的 redis 服务名称,在你的情况下是 redis ,所以连接将是:

   redis://dummy:dummy@redis:63790
于 2019-07-03T09:28:32.637 回答