redis 安装

# 查看当前所开放的端口
firewall-cmd --zone=public --list-ports


firewall-cmd --zone=public --add-port=6379/tcp --permanent


# 更新防火墙规则,使端口生效
firewall-cmd --complete-reload

创建docker-compose
version: '3.7'
services:
  redis:
  image: redis:6.0.6
  container_name: redis
  restart: always
  command: ["redis-server","/etc/redis/redis.conf"]
  ports:
    - 9876:9876
  volumes:
    - /disk/redis/data:/data
    - /disk/redis/conf/redis.conf:/etc/redis/redis.conf
  ports:
    - 6379:6379

docker-compose up -d

 

修改配置

bind:0.0.0.0

posted @ 2022-04-27 16:57  梦里前进  阅读(8)  评论(0编辑  收藏  举报