作者:GRcoder | 来源:互联网 | 2023-08-18 13:27
Dockerfile文件:FROMredisCOPYredis.confredisredis.confRUNln-sfusrsharezoneinfoAsiaShanghaietc
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