docker4drupal icon indicating copy to clipboard operation
docker4drupal copied to clipboard

How to access traefik

Open webprogrammierer opened this issue 2 years ago • 3 comments

After successful installation I can access: http://drupal.docker.localhost:8000/ http://mailhog.drupal.docker.localhost:8000/ http://pma.drupal.docker.localhost:8000/

But how can I access TRAEFIK? Thank you.

webprogrammierer avatar Dec 07 '21 13:12 webprogrammierer

Hi ! I guess traefik dashboard should be at : http://drupal.docker.localhost:8080/dashboard/

dclause avatar Dec 30 '21 21:12 dclause

Yes, thank you. I already have found it out by myself. The "Open in Browser" link in Docker Desktop is wrong.

What is traefik for?

webprogrammierer avatar Dec 30 '21 23:12 webprogrammierer

Hi! Sort answer : traefik redirects the traffic from your browser to the appropriate container.

Longer answer: when you request a service via the browser using a URL (say phpmyadmin.drupal.docker.locahost:8000), the browser has to transform it into an IP using the hosts file of your OS then a DNS requests if necessary to join the appropriate server. locahost address resolves to 127.0.0.1 which is your local IP. However, when using this address, you don't actually want to address a server locally but rather a service within a docker container which does not have itself an IP. For that, traefik acts as a sort of middleware, it listens to local traffic on a given port (8000 by default in this project) and redirects it to the appropriate docker container based on a set of urls (basically the URL) so the container can respond.

NOTE: docker4drupal has a local traefik configured at port 8000 for convenience. It starts in the container with all other services using the docker-compose command. But if you have two projects using docker4drupal you will have two traefik started conflicting. You will therefore need either to change the port of one of the traefik or use a global traefik. That means have another container running traefik in a separate project that can dispatch the traffic to multiple projects.

dclause avatar Dec 31 '21 10:12 dclause