feat:优化
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
version: '3'
|
||||
services:
|
||||
redis:
|
||||
image: registry.cn-shanghai.aliyuncs.com/odboy/ops:redis-7.0.5 # 镜像'redis:7.0.5'
|
||||
container_name: redis7 # 容器名为'redis'
|
||||
restart: unless-stopped # 指定容器退出后的重启策略为始终重启,但是不考虑在Docker守护进程启动时就已经停止了的容器
|
||||
command: redis-server /etc/redis/redis.conf --requirepass 123456 --appendonly no # 启动redis服务并添加密码为:123456,默认不开启redis-aof方式持久化配置
|
||||
# command: redis-server --requirepass 123456 --appendonly yes # 启动redis服务并添加密码为:123456,并开启redis持久化配置
|
||||
environment: # 设置环境变量,相当于docker run命令中的-e
|
||||
TZ: Asia/Shanghai
|
||||
LANG: en_US.UTF-8
|
||||
volumes: # 数据卷挂载路径设置,将本机目录映射到容器目录
|
||||
- "./redis/data:/data"
|
||||
- "./redis/config/redis.conf:/etc/redis/redis.conf" # `redis.conf`文件内容`http://download.redis.io/redis-stable/redis.conf`
|
||||
ports: # 映射端口
|
||||
- "6379:6379"
|
||||
@@ -0,0 +1,2 @@
|
||||
port: 16379
|
||||
password: 123456
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
# 当前目录下所有文件赋予权限(读、写、执行)
|
||||
chmod -R 777 ./redis
|
||||
# 运行 -- 单机模式
|
||||
docker-compose -f docker-compose-redis.yml -p redis7 up -d
|
||||
@@ -0,0 +1 @@
|
||||
docker-compose -p redis7 down
|
||||
Reference in New Issue
Block a user