docker版本:27.0.3
docker-compose版本:2.28.1
docker-compose文件
`
version: "3"
services:
halo:
image: registry.fit2cloud.com/halo/halo:2
environment:
- JVM_OPTS= -Xmx1024m -Xms1024m
restart: on-failure:3
depends_on:
halodb:
condition: service_healthy
networks:
halo_network:
volumes:
- ./halo2:/root/.halo2
ports:
- "8090: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
MySQL 的密码,请保证与下方 MYSQL_ROOT_PASSWORD 的变量值一致。
- --spring.r2dbc.password=o#DwN&JSa56
- --spring.sql.init.platform=mysql
外部访问地址,请根据实际需要修改
- --halo.external-url=http://localhost:8090/
- --privileged
halodb:
image: mysql:8.1
restart: on-failure:3
networks:
halo_network:
ports:
- "3307:3306"
command:
- --default-authentication-plugin=caching_sha2_password
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_general_ci
- --explicit_defaults_for_timestamp=true
volumes:
- ./mysql:/var/lib/mysql
- ./mysqlBackup:/data/mysqlBackup
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
interval: 3s
retries: 5
start_period: 30s
environment:
请修改此密码,并对应修改上方 Halo 服务的 SPRING_R2DBC_PASSWORD 变量值
- MYSQL_ROOT_PASSWORD=o#DwN&JSa56
- MYSQL_DATABASE=halo
networks:
halo_network:
`
然后mysql是能运行的,但是halo运行时报错
halo-1 | Error: Port Library failed to initialize: -86
halo-1 | Error: Could not create the Java Virtual Machine.
halo-1 | Error: A fatal exception has occurred. Program will exit.