Answer the question
In order to leave comments, you need to log in
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.
Answer the question
In order to leave comments, you need to log in
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question