# Deploy Treefik and Nextcloud using Docker

**URL:** <https://forums.docker.com/t/deploy-treefik-and-nextcloud-using-docker/133435>\
**Category:** General\
**Created:** [December 26, 2022, 10:16am UTC](https://forums.docker.com/t/deploy-treefik-and-nextcloud-using-docker/133435 "2022-12-26T10:16:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![valentin1707](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/valentin1707/32/38203_2.png) [@valentin1707](https://forums.docker.com/u/valentin1707)\
**Post date:** [December 26, 2022, 10:16am UTC](https://forums.docker.com/t/deploy-treefik-and-nextcloud-using-docker/133435/1 "2022-12-26T10:16:24Z")

</div>

Hi. 😀

I am using Ubuntu Server 20.04 LTS. 😃

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](https://www.digitalocean.com/community/tutorials/how-to-use-traefik-v2-as-a-reverse-proxy-for-docker-containers-on-ubuntu-20-04)  
[https://harambasic.de/posts/docker-compose-for-nextcloud-with-traefik-2-ssh/](https://harambasic.de/posts/docker-compose-for-nextcloud-with-traefik-2-ssh/)

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. 😃

Thanks. 😃

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [December 26, 2022, 11:57am UTC](https://forums.docker.com/t/deploy-treefik-and-nextcloud-using-docker/133435/2 "2022-12-26T11:57:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![valentin1707](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/valentin1707/32/38203_2.png) [@valentin1707](https://forums.docker.com/u/valentin1707)\
**Post date:** [December 26, 2022, 4:09pm UTC](https://forums.docker.com/t/deploy-treefik-and-nextcloud-using-docker/133435/3 "2022-12-26T16:09:33Z")

</div>

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. ☹

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

---

<div class="post-metadata">

**Author:** ![meyay](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/meyay/32/34000_2.png) [@meyay](https://forums.docker.com/u/meyay)\
**Post date:** [December 26, 2022, 4:37pm UTC](https://forums.docker.com/t/deploy-treefik-and-nextcloud-using-docker/133435/4 "2022-12-26T16:37:31Z")

</div>

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:

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…

---

<div class="post-metadata">

**Author:** ![valentin1707](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/valentin1707/32/38203_2.png) [@valentin1707](https://forums.docker.com/u/valentin1707)\
**Post date:** [December 26, 2022, 6:15pm UTC](https://forums.docker.com/t/deploy-treefik-and-nextcloud-using-docker/133435/5 "2022-12-26T18:15:21Z")

</div>

Thank you. I am using PI Hole with Unbound as my recursive DNS server. 😃  
Using Internal DNS option in PI Hole I added this: [mypublicdomain.net](http://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. 😃
