SOLO DOCKER 容器启动失败

本贴最后更新于 1151 天前,其中的信息可能已经天翻地覆

开发环境

WSL2-ubuntu20.04-LTS,MYSQL-SERVER-version:8.0.26-0ubuntu0.20.04.3 (Ubuntu)

SOLO-imageID:4afbc7964f83.

运行过程

  • MYSQL 已创建 solo 数据库和用户 root@127.0.0.1 密码为 123456:

solodb.jpg

userdb.jpg

  • 端口为 3306

portdb.jpg

  • 启动命令
sudo docker run --detach --name solo --network=host
--env RUNTIME_DB="MYSQL"
--env JDBC_USERNAME="root"
--env JDBC_PASSWORD="123456"
--env JDBC_DRIVER="com.mysql.cj.jdbc.Driver"
--env JDBC_URL="jdbc:mysql://127.0.0.1:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true"
b3log/solo --listen_port=8080 --server_scheme=http --server_host=localhost --server_port=

错误日志

[ERROR]-[2021-09-30 10:53:44]-[com.zaxxer.hikari.pool.HikariPool:593]: HikariPool-1 - Exception during pool initialization.

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure


The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:833) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:453) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.5.jar:?]

at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358) ~[HikariCP-3.4.5.jar:?]

at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-3.4.5.jar:?]

at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477) [HikariCP-3.4.5.jar:?]

at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560) [HikariCP-3.4.5.jar:?]

at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) [HikariCP-3.4.5.jar:?]

at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) [HikariCP-3.4.5.jar:?]

at org.b3log.latke.repository.jdbc.util.Connections.getConnection(Connections.java:196) [latke-core-3.4.14.jar:?]

at org.b3log.solo.service.InitService.initTables(InitService.java:165) [solo/:?]

at org.b3log.solo.service.InitService_$$_jvst59b_46._d7initTables(InitService_$$_jvst59b_46.java) [solo/:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]

at org.b3log.latke.ioc.JavassistMethodHandler.invoke(JavassistMethodHandler.java:108) [latke-core-3.4.14.jar:?]

at org.b3log.solo.service.InitService_$$_jvst59b_46.initTables(InitService_$$_jvst59b_46.java) [solo/:?]

at org.b3log.solo.Server.main(Server.java:267) [solo/:?]

Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure


The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_212]

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_212]

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_212]

at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.NativeSession.connect(NativeSession.java:144) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:953) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:823) ~[mysql-connector-java-8.0.23.jar:8.0.23]

... 20 more

Caused by: java.net.ConnectException: Connection refused (Connection refused)

at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_212]

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_212]

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_212]

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_212]

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_212]

at java.net.Socket.connect(Socket.java:589) ~[?:1.8.0_212]

at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.NativeSession.connect(NativeSession.java:144) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:953) ~[mysql-connector-java-8.0.23.jar:8.0.23]

at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:823) ~[mysql-connector-java-8.0.23.jar:8.0.23]

... 20 more

[ERROR]-[2021-09-30 10:53:44]-[org.b3log.solo.service.InitService:173]: Check tables failed, please make sure database existed and database configuration [jdbc.*] in local.props is correct [msg=Communications link failure


The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.]

尝试过的解决方法

用过自设的用户和密码(一开始以为是两个 root 冲突了),错误日志依旧相同。

可以用 mysql workbench 远程连接数据库,端口应该是没有问题。

权限也是按照教程正常赋予了。

求助

希望大佬们指导一下如何解决该问题。

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...
  • cbam

    "将 ip 改成宿主机后" 这句话是说 solo 启动命令中那个 ip 连接参数么

    1 回复
  • 其他回帖
  • 网络搜索 Docker 容器访问宿主机 MySQL。

    1 回复
  • bingoct
    作者

    非常感谢,创立了 host 为 % 的用户后将 ip 改成宿主机后改成功解决了问题。

    1 回复
  • bingoct
    作者

    是的,启动命令种连接数据库部分的参数。