我的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 。
有人可以帮忙吗?
答案 0 :(得分:0)
而不是localhost,而是输入您的redis服务名称(在您的情况下为redis),因此连接将类似于:
redis://dummy:dummy@redis:63790