halo_server  | 2022-05-22 04:06:24.239  INFO 7 --- [           main] o.e.jetty.server.handler.ContextHandler  : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext@29d81c22{application,/,[file:///tmp/jetty-docbase.8090.17835748594259052578/, jar:file:/application/BOOT-INF/lib/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],STOPPED}
halo_server  | 2022-05-22 04:06:24.240  WARN 7 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Jetty web server
halo_server  | 2022-05-22 04:06:24.283  INFO 7 --- [           main] ConditionEvaluationReportLoggingListener : 
halo_server  | 
halo_server  | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
halo_server  | 2022-05-22 04:06:24.300 ERROR 7 --- [           main] o.s.boot.SpringApplication               : Application run failed
    version: "3"
    
    services:
      halo_server:
        image: halohub/halo:latest
        container_name: halo_server
        restart: on-failure:3
        depends_on:
          - halo_mysql
        networks:
          halo_network:
        volumes:
          - ./:/root/.halo
          - /etc/timezone:/etc/timezone:ro
          - /etc/localtime:/etc/localtime:ro
        ports:
          - "8090:8090"
        environment:
          - SERVER_PORT=8090
          - SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.cj.jdbc.Driver
          - SPRING_DATASOURCE_URL=jdbc:mysql://halo_mysql:3306/halodb?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
          - SPRING_DATASOURCE_USERNAME=root
          - SPRING_DATASOURCE_PASSWORD=Lichang@2022
          - HALO_ADMIN_PATH=admin
          - HALO_CACHE=memory
    
      halo_mysql:
        image: mysql:latest
        container_name: halo_mysql
        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:
          - /etc/localtime:/etc/localtime:ro
          - ./mysql:/var/lib/mysql
          - ./mysql/logs:/var/log/mysql
          - ./mysql/mysqlBackup:/data/mysqlBackup
        ports:
          - "3306:3306"
        environment:
          # 请修改此密码,并对应修改上方 Halo 服务的 SPRING_DATASOURCE_PASSWORD 变量值
          - MYSQL_ROOT_PASSWORD=Lichang@2022
          - MYSQL_DATABASE=halodb
    
    networks:
      halo_network:

    johnnywongxy 好像是因为 Halo 容器连不上 MySQL 的容器,但是这个配置应该是没有什么问题的。可以再看看 MySQL 的容器是否正常。

    也可能和 Docker 的网络配置有关,不清楚和这个是不是同一个问题:halo-dev/halo2080

      Ryan Wang 👍
      嗯我去掉halo单启动mysql都不行 直接报错如下
      halo_mysql | 2022-05-22 16:06:56+08:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
      halo_mysql | 2022-05-22 16:06:56+08:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.29-1debian10 started.
      halo_mysql | 2022-05-22 16:06:56+08:00 [Note] [Entrypoint]: Initializing database files
      halo_mysql | 2022-05-22T08:06:56.110405Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
      halo_mysql | 2022-05-22T08:06:56.110413Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.29) initializing of server in progress as process 41
      halo_mysql | 2022-05-22T08:06:56.111484Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
      halo_mysql | 2022-05-22T08:06:56.111489Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
      halo_mysql | 2022-05-22T08:06:56.111558Z 0 [ERROR] [MY-010119] [Server] Aborting
      halo_mysql | 2022-05-22T08:06:56.111834Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.29) MySQL Community Server - GPL.
      halo_mysql exited with code 1

        johnnywongxy --initialize specified but the data directory has files in it. Aborting.

        好像是说 mysql 已经有文件了。

        5 天 后

        我把MySQL换成mariadb:latest那个成功了