如题,部署成功后,访问不了应用?
日志报错:
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: halodb/172.23.0.2:3308
halo2 | Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
使用的docker-compose.yaml文件内容如下:
version: "3"
services:
halo:
image: halohub/halo:2.0.2
container_name: halo2
restart: on-failure:3
depends_on:
halodb:
condition: service_healthy
networks:
halo_network:
volumes:
- ./:/root/.halo2
ports:
- "8088:8088"
environment:
- SPRING_R2DBC_URL=r2dbc:pool:mysql://halodb:3308/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/
# 初始化的超级管理员用户名
- HALO_SECURITY_INITIALIZER_SUPERADMINUSERNAME=admin
# 初始化的超级管理员密码
- HALO_SECURITY_INITIALIZER_SUPERADMINPASSWORD=P@88w0rd
halodb:
image: mysql:8.0.27
container_name: halodb
restart: on-failure:3
networks:
halo_network:
command: --default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
volumes:
- ./mysql:/var/lib/mysql
- ./mysqlBackup:/data/mysqlBackup
ports:
- "3308:3308"
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: