Home > Back-end >  Springboot on docker to run the database link
Springboot on docker to run the database link

Time:09-21

My configuration below, this problem bothering me for a long time, hope everybody to help me (QQ: 1463491008)

CodePudding user response:

If you met these writings in classical style, please help me, please

CodePudding user response:

My mysql visualization tool, which can be connected

CodePudding user response:

The database on the docker, too?

CodePudding user response:

Using mysql, it is also on the docker

CodePudding user response:

Let me see...

CodePudding user response:

Mysql again if another container, to map the ports to access mysql

CodePudding user response:

Chou Chou. Dockerfile should know

CodePudding user response:

refer to 7th floor qq_36111431 response:
Chou Chou. Dockerfile should know the

The FROM Java: 8
MAINTAINER Lhn
The ADD Spring - the Boot - 5-0.0.1 - the SNAPSHOT. Jar app. Jar
The RUN bash - c 'touch/app. Jar'
ENTRYPOINT [" Java ", "- the jar", "/app. The jar," "& amp;"]

CodePudding user response:

3306-3306 - p?

CodePudding user response:

reference 5 floor weixin_43869905 reply:
show me...

Do you want to see what, also ask you to give directions

CodePudding user response:

Is there a set all you that mysql access IP can access

CodePudding user response:

Docker usually use NAT or hosts exposed to external hosting

Usually this docker or between network communication between the host machine, using k8s would be far more convenient

CodePudding user response:

Could it be that the SQL version of the problem?

CodePudding user response:

If can use the mysql client connection, mysql container no problem, the problem should be your application container, you can enter into your application container, then ping IP host machine, see ping tong, suggest another docker communication between containers, either link or build isolated grid (docker network create)

CodePudding user response:

Thank you, now the problem has been solved!

CodePudding user response:

reference LHN. 15 floor response:
thank you, now the problem has been solved!

After asking questions of how to solve, and take

CodePudding user response:

Sorry sorry, too busy, I have no idea how to summarize, enter the docker, mysql in the container, check to mysql automatically assign IP, and then get IP, mysql container to project configuration file to change the database links (docker inspec container id | grep IPAddress)

CodePudding user response:

Recently a little busy, no time to summarize, the following is my summary, friend

CodePudding user response:

If the container is on the same machine, IP access cannot use localhost or directly use IP,,

Suggest docker network

CodePudding user response:

Not recommended for use localhost
  • Related