Skip to main content
Docker, mysql, apache and connection Started by emanuele · · Read 8279 times 0 Members and 1 Guest are viewing this topic. previous topic - next topic

Docker, mysql, apache and connection

Hey all!
I've finally found some time to set up a NAS-like Frankenstein and I slapped on it unraid for testing it and see if it fits with what I had in mind.
And so I started immediately trying php and mysql to finally set up again a place I could use to develop some code (scared, right? :D ).
Though, I'm facing a bit of a problem with docker (that I'm quite the noob about) and can't understand most of the instructions I find on line...:joy:

So, I'm running unraid and installed 3 docker containers:
# ApachePHP8 (192.168.1.250 <-> 192.168.1.250)
# MariaDB (172.17.0.3 <-> 192.168.1.136)
# phpmyadmin (172.17.0.2 <-> 192.168.1.136)

The latest two talk happily and I can access the db from phpmyadmin, though the apachephp one doesn't connect to mariadb.
The only thing that differs are the IPs, mariadb and phpmyadmin have the same IP 192.168.1.136 and work on different ports, while the apachephp has its own 192.168.1.250.
Could it be that this is the issue?
Any idea how to convince mariadb docker to accept connections from php?
Bugs creator.
Features destroyer.
Template killer.

Re: Docker, mysql, apache and connection

Reply #1

You can set up an internal docker lan.

https://docs.docker.com/compose/networking/

Or do links both are described on that link.

The issue is that they’re not all on the 172.x.x.x lan

Re: Docker, mysql, apache and connection

Reply #2

This may help ... https://github.com/Spuds/Docker-ElkArte/tree/php82

Look at the docker-compose.yml to see how to connect things together. 


Re: Docker, mysql, apache and connection

Reply #3

I should note, in that setup the  $db_server  would be:drum:  db  that is what you would use in something like Settings.php
when to use adminer you would navigate to 123.123.123.123:8080
and sphinx server would be:drum:  sphinx
and mailhog (a way to test smtp) would be at 123.123.123.123:8025 and you would setup the mail server as 123.123.123.123 port 1025 in the ACP

 

Re: Docker, mysql, apache and connection

Reply #4

Well... I did what I'm best at doing: I screwed up everything and had to restart from zero.:joy:

then, I realized the only issue was I used entirely different networks when I should have just used the same and set different IPs.
Well, me and networks are not exactly friends. :D
Bugs creator.
Features destroyer.
Template killer.