I am new to docker and docker-compose.
I have mysql running in a docker container, with two databases initialized.
I can connect to it using:
mysql --port=3306 -h192.0.0.1 -uroot -ppassword
When I run:
docker ps
04bc1d308484 container-mysql "docker-entrypoint.sh" 2 hours ago Up 2 hours 3306/tcp container-mysql
My query is that now I want to connect to it from another container using
docker-compose up.
another-image:
image: another-image
command: /opt/start.sh
ports:
- "8080:8080"
environment:
DB_URL: container-mysql
DB_USER: root
DB_PASSWORD: password
external_links:
- container-mysql
Can someone please guide me whats missing and what else is needed.
My container-mysql has two database schema's.
Example: firstdb seconddb
docker-compose.ymlfile github.com/LaraDock/laradock/blob/master/docker-compose.yml Also check the DB container and it's base image to get a full overview of what's going on and how it's working. Best.