Deploy Treefik and Nextcloud using Docker

Hi. :grinning:

I am using Ubuntu Server 20.04 LTS. :smiley:

I am trying to deploy my Nextcloud instance behind Traefik reverse proxy using Docker and my own domain.
Tutorial i used: How To Use Traefik v2 as a Reverse Proxy for Docker Containers on Ubuntu 20.04 | DigitalOcean
Docker Compose for NextCloud with Traefik 2 (SSL) - Luka Harambasic

After setup Traefik and Nextcloud access by accessing my subdomain are working perfectly but only from outside network, SSL and everything. I can not access this two services from my own network.

If I understand this, i have to expose a port. Can someone give me some example what cloud i do to fix this. :smiley:

Thanks. :smiley:

Please tell us more about your setup.

Are you running your setup in a Cloud environment, on a VPS, a homelab or somewhere else?

Since no information about the setup is provided, the only guess I can make it that the Docker engine is sitting in a NATed network behind an ISP provided WAN router which doesn’t support NAT loopback.

1 Like

This is a homelab enviroment with my ISP router. There has to be something with this Docker config fail, i need to expose some ports to access Nextcloud via server internal IP:port, but i dont now how. :frowning:

Outside access to Traefik and Nextcloud is working perfectly but access vi internal IP from my own local network is not working at all.

What you need to do depends on what you want to achieve.

At least three options come to mind.

  • if it’s just about reaching NC from your internal network bypassing Traefik: publish a port on the NC container, the same way that you already did it for the Traefik container - pick a free host port of your choosing, make sure to use the container port as specified in the NC dockerhub description.

  • If it’s about reaching NC through Traefik using your public domain, then temper the name resolution to make the domain resolve to your docker host:

    • you could modify your computer’s host file (please google for the file location for your os)
    • add a dns server to your network that allows to add domain overrides (like pihole or unbound) and configure it to be the dns server provisioned by your routers dhcp server. Then add an override for the public domain and resolve it to your docker host.

Though, if you ISP router supports NAT loopback, none of those things would be necessary, and you should be able to reach your NC container through the public domain name, like everyone else…

1 Like

Thank you. I am using PI Hole with Unbound as my recursive DNS server. :smiley:
Using Internal DNS option in PI Hole I added this: mypublicdomain.net MydockerServer instance IP address and now i can resolve thou my internal DNS server and run my Nexctcloud server internaly and externaly without any problems. :smiley: