Docker Community Forums

Share and learn in the Docker community.

Pterodactyl docker container cannot connect to localhost mysql database

(Samkist) #1

Note, Im actually using docker on linux 16.04, anyways I have container that are mandated created and controlled by the pterodactyl game panel I installed.

I have found multiple solutions but none seem to accommodate my issue. I found this command but I’m not sure how to apply it

[quote=“mikehaertl, post:5, topic:14248, full:true”]
The main problem for me was to reliably find out the IP address of the host. So in order to have a fixed set of IPs for both my host and my containers I’ve set up a docker network like this:

docker network create -d bridge --subnet --gateway dockernet

Now each container can connect to the host under the fixed IP

You just need to make sure, that you connect all your containers to that “dockernet” network you just created. You can do that with the --net=dockernet option for docker run. Or from a docker-compose.yml:

version: '2’
image: some/image
- dockernet
external: true

Networks are described in the network documentation. They are quite useful and not very hard to understand.

If anyone has any insight please let me know.