I
I
isaac-212021-01-10 05:20:56
Python
isaac-21, 2021-01-10 05:20:56

How to connect mysql database to docker container?

There is a script (training, for understanding) that adds an entry to the database
in my view, I have to make a container with this script,
as well as a container with a database ("all the information is on the computer, so using volume I transfer the folder with mysql ")
Please tell me how to properly configure the two containers so that they see each other and interact, also for some reason, when I tried (unsuccessfully), I had to reinstall mysql, he did not want to start the service.
I would be grateful for any help and hints on how to arrange everything correctly.
5ffa641421bed859789438.png5ffa641cd64d5414173032.png5ffa64229115f307306097.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Diezam, 2021-01-10
@isaac-21

To learn how containers written in one docker-compose.yml file interact with each other, I recommend that you read the official documentation: https://docs.docker.com/compose/networking/ .
It is perfectly described there that by default, for each environment launched through compose, a private virtual network is created, with nat to the network available on the host. All compose containers run on the same network and can address each other directly by name and without restrictions.

I
isaac-21, 2021-01-18
@isaac-21

Diezam , unfortunately, does not see my script from the docker database
as soon as it has not twisted already ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question