docker-compose搭建redis集群

Dockerfile文件:

FROM redis

COPY redis.conf /redis/redis.conf

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone

RUN chmod 777 /redis/redis.conf

EXPOSE 6381
EXPOSE 16381

CMD [ "redis-server", "/redis/redis.conf" ]

 

docker-compose.yml文件:

version: '2'
services:
  redis-slave1:
    build: ./slave1
    ports:
      - 6381:6381
      - 16381:16381
    network_mode: "host"
    restart: always
  redis-slave2:
    build: ./slave2
    ports:
      - 6382:6382
      - 16382:16382
    network_mode: "host"
    restart: always

posted @ 2019-10-22 14:26  黑崎一护有头屑  阅读(4198)  评论(0编辑  收藏  举报