创建配置文件
vim docker-compose.yaml
version: "3"
services:
halo:
image: halohub/halo:2.14
restart: on-failure:3
depends_on:
halodb:
condition: service_healthy
networks:
halo_network:
ports:
- "80:8090"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090/actuator/health/readiness"]
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
command:
- --spring.r2dbc.url=r2dbc:pool:mysql://halodb:3306/halo
- --spring.r2dbc.username=root
- --spring.r2dbc.password=o#DwN&JSa56
- --spring.sql.init.platform=mysql
- --halo.external-url=http://localhost:8090/
halodb:
image: mysql:8.1.0
restart: on-failure:3
networks:
halo_network:
ports:
- "3333:3306"
command:
- --default-authentication-plugin=caching_sha2_password
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_general_ci
- --explicit_defaults_for_timestamp=true
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
interval: 3s
retries: 5
start_period: 30s
environment:
- MYSQL_ROOT_PASSWORD=o#DwN&JSa56
- MYSQL_DATABASE=halo
networks:
halo_network:
构建镜像
docker-compose up -d
查看容器日志
docker-compose logs -f
最终效果

当然有疑问的地方也可以联系作者,直接评论或者加站长微信。

评论区