# 编辑数据库配置文件
vim db.env
# 写入以下信息
MYSQL_PASSWORD=
MYSQL_DATABASE=kodbox
MYSQL_USER=kodbox
docker-compose.yml
version: '3.5'
services:
db:
image: mariadb:10.6
restart: unless-stopped
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=
- MARIADB_AUTO_UPGRADE=1
- MARIADB_DISABLE_UPGRADE_BACKUP=1
env_file:
- db.env
app:
image: kodcloud/kodbox
restart: unless-stopped
ports:
- 80:80 #左边80是使用端口,可以修改
volumes:
- "./site:/var/www/html" #./site是站点目录位置,可以修改
environment:
- MYSQL_HOST=db
- REDIS_HOST=redis
env_file:
- db.env
depends_on:
- db
- redis
redis:
image: redis:alpine
restart: unless-stopped