Docker部署redis

Article2周前更新 Done
68 00

部署

Docker部署redis

部署Docker教程:https://bj.cddone.com/doc/14

1、创建工作目录

mkdir -p /home/docker/redis && cd /home/docker/redis
mkdir -p /home/docker/redis && cd /home/docker/redis

2、创建配置文件

cat <<EOF> redis.conf
port 6379
save 900 1
save 300 10
save 60 10000
dir /data
loglevel notice
appendonly no
EOF
cat <<EOF> redis.conf port 6379 save 900 1 save 300 10 save 60 10000 dir /data loglevel notice appendonly no EOF

3、创建wordpress容器yaml

  • 参数说明:
  • 设置镜像
  • 设置容器名称
  • 设置容器自启动
  • 映射端口
  • 映射目录
  • 数据持久化
cat <<EOF> docker-compose.yaml
redis:
image: redis:latest
container_name: redis
restart: always
ports:
- "16379:6378"
volumes:
- ./redis.conf:/usr/local/etc/redis/redis.conf
- ./data:/data
command: redis-server /usr/local/etc/redis/redis.conf --appendonly yes
EOF
cat <<EOF> docker-compose.yaml redis: image: redis:latest container_name: redis restart: always ports: - "16379:6378" volumes: - ./redis.conf:/usr/local/etc/redis/redis.conf - ./data:/data command: redis-server /usr/local/etc/redis/redis.conf --appendonly yes EOF

4、启动wordpress容器

docker-compose up -d
docker-compose up -d

5、查看容器状态

docker ps
docker ps

 

 

© 版权声明

相关文章

暂无评论

none
暂无评论...