Hello,
I have aapanel installed on my host (IP 192.168.254.10) and I'm running Gogs in a Docker container with ports 3000 and 22022 exposed. The MySQL/MariaDB database is running on the host (via aapanel). Several PHP scripts on the host using 127.0.0.1 can connect to the database without any problem. However, Gogs inside the Docker container fails to connect to the database.
In aapanel's database permission settings, I have tried:
Setting permission to "everyone"
Setting permission to "local server"
Setting permission to "specified IP" with 192.168.254.0/24 (the subnet of my host and other VMs)
But neither works. I suspect the issue is that Gogs inside the container tries to connect to 127.0.0.1 or localhost, which inside the container is its own loopback, not the host's database. What is the correct IP address I should use in Gogs' database configuration to reach the host's database from the Docker container? Should I use the host's actual IP (192.168.254.10) or the Docker gateway IP (e.g., 172.17.0.1)? Also, do I need to configure any additional firewall rules on the host or in aapanel to allow the container to connect?
Any guidance would be appreciated. Thank you!



