Understand File Provider in Traefik 2
HTML-код
- Опубликовано: 22 авг 2024
- In my previous videos I've shown you how to deploy applications with Docker and Traefik 2.
In this video, I demonstrate how to use File Provider to config Traefik 2 dynamically.
You can find my related article at
tech.aufomm.com
Thank you for your introduction, I really appreciate it. My goal is not to expose the unix docker socket to traefik
Using labels in the docker compose is better than using the config file in my opinion.
Edit: 13 days later, I now agree that the file provider is better lol. Its a lot cleaner and i like not having all the redundant stuff in the docker compose file. Great vid man
Hi Keem, thanks for the update and I am glad you also find file provider is cleaner and easier to use.
If you are interested in using Kubernetes, you will find the concept of deployment, service, ingress similar to what you have for file provider.
Thank you Li, this helped me so much. Please, if you have any time - I would like to see more tutorials from you. It's amazing. Your explanations are easy to follow, you explain it in depth and it helps so much. Thank you again and have a nice day.
Great post thanks. Just what I was looking for
Thanks Richard, I am glad you find the information useful.
Thanks, now I full understand file providers!
Can you show working with custom plugins? Great video👍🏾
Thank uuu
But what about the ip of the container, if we restart or recreate one , the ip will change
and with the labels, it doesn't matter , right ?
Hi Mikey. You are the first viewer to comment on my videos in a row. 😊
From my experience, internal ip address of a container/service does not change when you restart/recreate it. You only need to check internal ip when you are creating a new service.
You don't need to worry about the internal ip address when you use label as Traefik will find the container automatically.
In fact, with labels, you don't even need to define service with labels as Traefik will do it for you automatically. docs.traefik.io/routing/providers/docker/#service-definition
@@liyangau hehe yeah i'm becoming a faan 😁
ooh thank you for all this infos 😊
by the way, did you ever try "nginx proxy manager" to compare with Traefik
I see you mounted a whole folder with dynamic configurations in your traefik docker-compose. Is there a way to mount only a file and still be able to dynamically change the config without restarting the container? If i mount only a file, i will have to restart the traefik.
use filename instead of directory under fileprovider
I have an issue with Traefik. Where can someone contact you?
Can a file provider configuration handle swarm mode too? I seem to be having problems deploying in that manner, not sure if the deploy/labels in the docker compose is then mandatory. (For all services, not just dashboard.)
Hi Jeffery, although I have not tested it yet, I think you must use docker provider in swarm mode. According to Traefik's documentation, doc.traefik.io/traefik/providers/docker/#routing-configuration-with-labels_1 , it seems that labels need to be used for routing.
Thanks Li. After fiddling with it, I was coming pretty much to that conclusion. I'll probably go without the swarm here since it isn't really strictly needed. I do (or will) have a need for it and was sort of hoping to get it going here so that the actual case that needs it would not be too much of a problem.
You do realize that it doesn't actually load the nginx index.html file? It's seems to be a routing issue. No matter what I do I keep getting '404 Not found".
I've just tested and it works if you start traefik as a linux process (e.g. systemd or traefik executable for quick testing), not from docker container.
Thanks a lot..is it possible to add a service without adding a router?
HI Sanoj, you can add as many services as you need without assigning a router. It is similar concept as in k8s which you defines service but not assigning ingress to it. Without a router, your service won't be exposed.
@@liyangau genius man..keep making such good videos on traefik..really the best fit which i was looking for..
@@liyangau i tried putting hostname as ip:port in dynamic.yaml but doesnt load my root service still😢
unfortunately you did not show any working example of config