镜像访问宿主主机mysql(宝塔docker管理器部署)

14次阅读

共计 475 个字符,预计需要花费 2 分钟才能阅读完成。

本帖最后由 zzkuner 于 2024-4-10 01:40 编辑

试过 –net=host 和 –add-host=host.docker.internal:host-gateway
都不能让镜像访问宿主主机的数据库,
我怀疑是我宝塔的 Docker 管理器配置有点问题
请教一下各位大佬
我是把下面这段代码填到这个启动命令中的,不知道是什么原因,各位大佬不吝赐教

–add-host=host.docker.internal:host-gateway
–spring.datasource.url=jdbc:mysql://host.docker.internal:3306/note?useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
–spring.datasource.username=root
–spring.datasource.password=111

正文完
 0