私有化部署一个自己的网盘
效果
安装
1.创建目录
cd /opt
mkdir -p kod/{db,site}
cd /opt/kod
2.环境文件
vim db.env
内容如下
MYSQL_PASSWORD=123456
MYSQL_DATABASE=kodbox
MYSQL_USER=kodbox
3.编写docker-compose.yml
vim docker-compose.yml
内容如下
version: '3.5'
services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- "./db:/var/lib/mysql" #./db是数据库持久化目录,可以修改
# - "./etc/mysql/conf.d:/etc/mysql/conf.d" #增加自定义mysql配置
environment:
- MYSQL_ROOT_PASSWORD=123456
- MARIADB_AUTO_UPGRADE=1
- MARIADB_DISABLE_UPGRADE_BACKUP=1
env_file:
- db.env
app:
image: kodcloud/kodbox
restart: always
ports:
- 10001:80 #左边80是使用端口,可以修改
volumes:
- "./site:/var/www/html" #./site是站点目录位置,可以修改
environment:
- MYSQL_HOST=192.168.168.1
- REDIS_HOST=192.168.168.1
env_file:
- db.env
depends_on:
- db
- redis
redis:
image: redis:alpine
restart: always
ports:
- 6380:6380
使用
打开浏览器,输入地址
http://localhost:10001/