Docker安装Redis

安装 Redis

创建文件

1
mkdir /docker/redis-7/redis.conf

创建容器

1
docker run -p 6379:6379 --name redis-7 -v /docker/redis-7/redis.conf:/etc/redis.conf -d redis:7 redis-server /etc/redis.conf --appendonly yes
1
docker run -d -p 6379:6379 --name redis8.0 -v E:/docker/redis/conf/redis.conf:/etc/redis/redis.conf -v E:/docker/redis/data/:/data/ -v E:/docker/redis/logs/:/logs --privileged=true --restart=always redis:8.0 redis-server /etc/redis/redis.conf

修改deamon.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
vim /etc/docker/daemon.json

{
"builder": {
"gc": {
"defaultKeepStorage": "64GB",
"enabled": true
}
},
"experimental": false,
"registry-mirrors": [
"https://hub-mirror.c.163.com",
"https://mirror.baiduce.com",
"https://cv2w2bcm.mirror.aliyuncs.com",
"https://docker.mirrors.ustc.edu.cn",
"https://registry.docker-cn.com",
"https://docker.211678.top",
"https://docker.1panel.live",
"https://hub.rat.dev",
"https://docker.m.daocloud.io",
"https://do.nark.eu.org",
"https://dockerpull.com",
"https://dockerproxy.cn",
"https://docker.awsl9527.cn",
"https://hub.docker.com"
]
}

重新加载配置文件

1
systemctl daemon-reload

重启docker

1
systemctl restart docker

查看docker状态

1
systemctl status docker

ubuntu安装redis

1
docker run --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --volume=/opt/application/docker/redis/data/:/data/ --volume=/opt/application/docker/redis/logs/:/logs --volume=/opt/application/docker/redis/conf/redis.conf:/etc/redis/redis.conf --volume=/data --network=bridge --privileged --workdir=/data -p 6379:6379 --restart=always --runtime=runc -d redis:8.0

评论