I need to connect my “mysql” databases to apache2 server as a microservice. I have update the “-link of the mysql container in the apache2 container”, my bad luck that is not reflected in the /etc/hosts
of the apache2 server.
my docker-compose.yml file
version: '2'
services:
mysql:
image: 'mysql'
environment:
- MYSQL_USERNAME=root
- MYSQL_ROOT_PASSWORD=xxxxxxx
ports:
- '3309:3306'
volumes:
- ./volume/mysql:/var/lib/mysql
prestashop:
image: 'riay.r/presta-apache'
ports:
- '25:25'
- '8081:80'
- '443:443'
links:
- 'mysql:database'
volumes:
- ./volume/html:/var/www/html
- ./volume/apache2/sites-enabled:/etc/apache2/sites-enabled
depends_on:
- mysql
phpmyadmin:
image: 'registry.poornam.com:5000/phpmyadmin/phpmyadmin'
ports:
- '8080:80'
environment:
- MYSQL_USERNAME=root
- MYSQL_ROOT_PASSWORD=xxxxxxxx
- PMA_HOST=prestashop
depends_on:
- mysql
- prestashop
In the prestashop container /etc/hosts not updated with the mysql ip and hostid or container id.