docker-compose容器化构建redis

redis 的yml 文件

cat redis.yml

version: '3.2'
services:
  redis:
    image: redis:5.0.5
    container_name: redis
    restart: always
    command: ["redis-server", "--appendonly", "yes", "--requirepass","复杂密码"]
    ports:
      - 6379:6379
    volumes:
      - /data/redis_data:/data

准备挂载目录

mkdir /data/redis_data

启动redis

docker-compose -f redis.yml up -d 
posted @ 2020-12-02 11:04  邹姣姣  阅读(231)  评论(0编辑  收藏  举报