Network and DNS Setup
General
First up, if you want to connect to any of your apps from the Interwebs, you are going to need a domain. Go get one. CloudFlare is a good spot to buy and manage a domain. If you want a .com.au you'll need an Australian registrar.
For Traefik to do what it does, both from a traffic routing, and SSL certificate perspective, you need DNS CNAME or A records for your services.
In my lab, I use DynamicDNS to update CloudFlare with the current IP address of my router, so that the A record I have of 'lab.fertle.com' always resolves to my router's address. From there, I create CNAMEs that point to lab.fertle.com.
From a router perspective, you just need to port forward 443 and 80 to the IP address of your docker host. Make sure those ports are open on the host's local firewall.
Docker Networking
Docker can do some complicated shit with it's networking. I don't go in for any of that, too hard. There are a couple of things to mention though.
- If you want a container to be exposed to the internet behind Traefik, it has to use the traefik_proxy network.
- If you still want to access the given service on your local LAN, as well as being behind Traefik, you need to add it to the 'default' network also.
- If you are choosing option 2, to access the service on the container from your LAN, you have to port-forward traffic out of your container. You will see in many docker-compose.yml examples, lines like this:
This is telling Docker to forward traffic from outside to inside the container. The first number will be the port your docker host is listening on (LAN side) and the second is the port inside the container.ports: - 5055:5055
Most of the time these numbers can be the same, but as you run more and more containers you will find that you'll have to change the external port number to deconflict with other containers.
No comments to display
No comments to display