nextcloudpi won’t work with traefik. afaik. it has a build-in “get a cert and redirect to port 443”. traefik must talk to port 80 of the nextcloud container and will be redirected to port 443. and nextcloudpi won’t be able to get a valid certificate for it’s container name. (hope you get the problem.)
i can’t promise that it will work on a raspi OS lite: GitHub - ReinerNippes/nextcloud_on_docker: Run Nextcloud in Docker Container on various Linux Hosts . but you may try.
or you search for a docker-compose file to setup nextcloud and traefik. there are several available.
nextcloud pi should have this build in. so you don’t need traefik.
btw: we had a similar discussion here: Migration to Traefik with Nextcloud/LinuxServer image: need help! the LinuxServer image has also build in letsencrypt/https and won’t work with traefik.