Let docker containers work with each other

I’m new to docker and I want to dockerize a aleardy existing application.

It consists of a react application (I already created a container for that one successfully), a REST-api based on node-express (that one kinda works) and a mysql-database (not workin so far).

While developing I put a proxy into the package.json file of my React-Application. This enabled me to forward all the api-requests to a different port. And I want to also have this feature between my docker containers. So that my react application on port 3000 for example forwards all the unknown requests to the rest api on port 5000 via a proxy. Port 3000 and 5000 are in different containers.

Furhtermore I need the REST-container to have access to port 3306 of another mysql-container. This other mysql container still needs to be created though. It should use hypriot/rpi-mysql or something similar and within the dockerfile it should import a given .sql file into the database and then run in the background.

So my questions are: What would be the best way to share ports among the containers?
How can I set up a Dockerfile for a MySql container with a .sql file as setup?

Use docker-compose and start all containers from one compose file.

If you go to the docs of the MySQL image, you find an explanation under ‘Initializing a fresh instance’. You have to do this a the first start of the container, during later starts this file is ignored.