Giter VIP home page Giter VIP logo

Comments (2)

hncboy avatar hncboy commented on July 18, 2024

试试用新的 docker-compose,MySQL 和 Java 一起装。

from ai-beehive.

StephenHuge avatar StephenHuge commented on July 18, 2024

[问题描述]

  1. 根据README的脚本命令安装了mysql,且启动成功,如下图所示:
image
  1. 修改docker-compose.yml文件,采用
docker-compose up -d

命令启动后,启动报错,提示连不上数据库,请问这个IP地址是采用localhost,还有哪个地址?

有两种方案:

  • Dockerfile_mysql启动MySQL实例,然后本地java启动去连接这个容器
  • 用docker-compose启动java+MySQL

你这么做连接失败的原因是:
首先docker-compose中构建了局域网,里面定义了2个容器java2和mysql2。
你先使用Dockerfile_mysql启动了一个独立的mysql_1容器,导致mysql2容器无法启动(端口冲突),但java2应用程序启动成功了。java2使用JDBC URL指定了mysql2,但mysql2未启动,因此无法连接。
image

from ai-beehive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.