take a look at this post - I describe pretty complete docker setup with traefik - this is cool reverse proxy working really* smooth with docker. with traefik requesting letsencrypt certificates is really easy and it just work
if you don’t like or can’t follow the post just search for docker, traefik and nextcloud in this forum or google/youtube - there are lot of tutorials explaining how to setup nextcloud in docker with traefik.