部署

部署Docker教程:https://bj.cddone.com/doc/14
1、创建工作目录
mkdir -p /home/docker/redis && cd /home/docker/redismkdir -p /home/docker/redis && cd /home/docker/redis
2、创建配置文件
cat <<EOF> redis.confport 6379save 900 1save 300 10save 60 10000dir /dataloglevel noticeappendonly noEOFcat <<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.yamlredis:image: redis:latestcontainer_name: redisrestart: alwaysports:- "16379:6378"volumes:- ./redis.conf:/usr/local/etc/redis/redis.conf- ./data:/datacommand: redis-server /usr/local/etc/redis/redis.conf --appendonly yesEOFcat <<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 -ddocker-compose up -d
5、查看容器状态
docker psdocker ps
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...