准备docker-compose文件
version: '3'
services:
lskypro:
image: halcyonazure/lsky-pro-docker:latest
restart: unless-stopped
hostname: lskypro
container_name: lskypro
volumes:
- ./lsky-data:/var/www/html/
ports:
- "9080:80"
networks:
- lsky-net
mysql-lsky:
image: mysql:5.7.22
restart: unless-stopped
# 主机名,可作为"数据库连接地址"
hostname: mysql-lsky
container_name: mysql-lsky
# 修改认证方式
command: --default-authentication-plugin=mysql_native_password
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/conf:/etc/mysql
- ./mysql/log:/var/log/mysql
environment:
MYSQL_ROOT_PASSWORD: lskY12.3 # 数据库root用户密码,自行修改
MYSQL_DATABASE: lsky-data
networks:
- lsky-net
networks:
lsky-net: {}
这里将9080端口映射到了容器的80端口。
手动准备目录
├── lsky-data
├── mysql
│ ├── conf
│ ├── data
│ ├── log
└── docker-compose.yml
运行
项目根目录下执行
docker-compose up -d
成功运行后使用浏览器进入lskypro的web:http://ip:9080