elestio-examples / glpi

Deploy GLPI with CI/CD on Elestio
6 stars 5 forks source link

Wrong host IP configuration #1

Closed enricobenedos closed 10 months ago

enricobenedos commented 10 months ago

We are trying this new image in order to move GLPI on docker environment.

Is there any specific reason to put a static IP on all containers host ports? We think that probably it doesn't work on any environment different from yours.

This is the error simply getting the docker-compose.yml file from your docker hub page: Error response from daemon: Ports are not available: exposing port TCP 172.17.0.1:22571 -> 0.0.0.0:0: listen tcp 172.17.0.1:22571: can't bind on the specified endpoint

jbenguira commented 10 months ago

Hey @enricobenedos 172.17.0.1 is always the host docker ip address, at least it's the case for docker engine on Ubuntu that we use as our OS on Elestio. We do that to avoid direct exposure of the port on the IP address and our reverse proxy (based on Nginx) is doing the SSL termination and sending the traffic to the container.

Of course you can remove the 172.17.0.1: prefix if that doesn't work for your environment

enricobenedos commented 10 months ago

Yes, you are right about the host docker IP address.

Probably the given docker compose file is tested only on Linux environment. Normally we are get used to have docker compose files working with no issues on bot Windows, Linux and macOS.

What about using docker networks with a more reliable way to manage unwanted ports exposure? At this point you can avoid to expose ports and use docker local DNS resolution.

jbenguira commented 10 months ago

TBH we had a lot of issues with docker networks (strange behaviors, worst performances), so we never use them and networking is simple and without issues.

On your Mac solution is to remove the prefix? anything else you changed to make it work? We might update the doc based on that

enricobenedos commented 10 months ago

At the moment I'm using Windows 11 as development OS but normally we deploy docker services and apps to Linux VMs.

Anyway we never experienced issues with docker networks until today, except sometimes for DNS problems with particular apps. In fact we use a lot docker networks because they provide a good way to resolve container services without passing through the machine ethernet adapter and avoiding to expose DB ports if not necessary.

Removing all statics IPs from docker compose file solve the startup problem. The next problem now seems related with the database server address, which is the right value to input by you? The more natural way is to use myMachineIp:50778 but at this point an error is returned: The server answered: No such file or directory.

image

jbenguira commented 10 months ago

the db should be reachable on the docker container name with native port:

mysql:3306

or on the host ip address on port 50778 you can test with "telnet 127.0.0.1 50778"

enricobenedos commented 10 months ago

It now works but only with mysql:3306; all the other tests using local IP address with 50778 returns connection refused.

Hope that the docker-compose file and other configurations will be updated to support also Windows as well.

Thank you