On this perticular host I have quite a few docker-compose structures running, many of them with mysql databases.
When I try to add a new on this perticular app(service) seems to use another (needed) network to communicate with the result that it’s connecting to another mysql instance from another compose file.
Below my compose file:
version: ‘3’
services:
db:
image: mariadb
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- ./db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=xxxx
env_file:
- db.env
networks:
backend_next:
app:
image: nextcloud:apache
restart: always
volumes:
- ./nextcloud:/var/www/html
- ./php.ini:/usr/local/etc/php/conf.d/custom.ini
environment:
- MYSQL_HOST=db
- VIRTUAL_HOST=next.xxx.xxxx.site
- LETSENCRYPT_HOST=xxx.xxxx.site
- LETSENCRYPT_EMAIL=xxxx@xxxx.com
env_file:
- db.env
depends_on:
- db
networks:
backend_next:
proxy_proxy-tier:
networks:
backend_next:
proxy_proxy-tier:
external: true
I absolutely need the proxy_proxy-tier network so that app can be routed by the proxy and I would need app to connect to db using the backend_next network.
But what happens is that app uses the proxy network and actually connects with another mysql instance that is running on that same host.
Does somebody know how I can make app specifically use backend_next for the database connection?
Help much appreciated.