docker安装redis6.2.x

docker 快速安装redis6.2.14,这里只是单节点部署

下载rdis镜像6.2.14
docker pull redis:6.2.14

1、创建挂载目录
mkdir -p /usr/local/redis-6/config
mkdir -p /usr/local/redis-6/data

2、配置redis配置文件(可以从官网上下载对应版本的redis安装包zip/tar.gz,拷贝一份redis.conf做修改即可)
修改Redis配置文件
a)注意注释 # bind 127.0.0.1 ::1 允许redis外地连接 必须

# 注释 # bind 127.0.0.1 ::1 允许redis外地连接
# bind 192.168.1.100 10.0.0.1 # listens on two specific IPv4 addresses
# bind 127.0.0.1 ::1 # listens on loopback IPv4 and IPv6

# 将daemonize yes注释起来或者 daemonize no设置,因为该配置和docker run中-d参数冲突,会导致容器一直启动失败
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
# When Redis is supervised by upstart or systemd, this parameter has no impact.
daemonize no

3、执行运行
docker run --name redis6 -p 6379:6379
–privileged=true
–restart=always
-v /usr/local/redis-6/config/redis.conf:/etc/redis/redis.conf
-v /usr/local/redis-6/data:/data
-d redis:6.2.14 redis-server /etc/redis/redis.conf

完成

你可能感兴趣的:(docker,docker,eureka,容器)