Began to master Docker. There are two images: based on the first container initialized with Php + Apache + mounted volume with php application (yii2) + put Composer and Git, based on the second - Mysql. I do all this through Docker-compose.
Docker-compose.yml content
version: '2'
services:
app:
build:.
volumes:
- ./app:/var/www/html
ports:
- "80:80"
links:
- db
db:
image: mysql: 5.7
ports:
- "3306: 3306"
expose:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: pass
MYSQL_DATABASE: docker_template
The question is this: I need to apply the migration by running the "php yii migrate" command. In the container with Php, I do not have Mysql, so Yii2 will give an error when starting migrations. And in the container with Mysql I do not have Php and a mounted image. What to do in this situation? Do I understand correctly that I can not connect to Mysql from within a php container?