How I connected a network_mode: host container to its database container
I have setup my FreePBX to use network_mode: 'host'
but faced issues when it couldn’t connect to the MariaDB container which was not using network_mode: 'host'
.
I fixed this by:
- Setting the MariaDB container to
network_mode: 'host'
- Setting the FreePBX container to connect to
127.0.0.1
(DB_HOST=127.0.0.1
). Setting it tolocalhost
did NOT allow FreePBX to connect to MariaDB!