Defaultrule, double container name

this is my traefik docker-compose.yml file

version: "3.5"
services:
  traefikv2:
    container_name: traefikv2
    image: traefik:latest
    command:
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --api.dashboard=true
      - --api.insecure=true
      - --providers.docker=true
      - --global.sendAnonymousUsage=true
      - --providers.docker.defaultrule=Host(`{{ .Name }}.redacted.nl`)
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    environment:
      - TZ=europe/amsterdam
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /docker/traefik:/storage
    networks:
      - test
    restart: always

networks:
  test:
    name: test

this is my portainer docker-compose.yml file

version: '3.5'

services:
  portainer:
    container_name: portainer
    image: portainer/portainer
    volumes:
      - /docker/portainer:/data
      - /var/run/docker.sock:/var/run/docker.sock
      - /etc/localtime:/etc/localtime:ro
    environment:
      - TZ=europe/amsterdam
    networks:
      - test
    restart: always

networks:
  test:
    name: test

Every container gets reversed proxied with the default rule.
However, the name, is like portainer-portainer.redacted.nl or traefikv2_traefik.redacted.nl

somehow, the stack gets prepended in the Name variable.

Is there a variable available with just containername, or some smart regex which fixes this ?
i just want "portainer.redacted.nl"

in version 1.7 i had the same thing, and created a hostrule per docker-compose file.
With this new system, i was hoping to automate this with a default rule.

I have seen the documentation, but only the Name or Label variable is mentioned. I wouldn't know on how to create a GO template

Hello,

You can use the labels created by Docker it-self, by example:

    command:
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --api.insecure=true
      - --providers.docker=true
      - --global.sendAnonymousUsage=true
      - '--providers.docker.defaultrule=Host(`{{ index .Labels "com.docker.compose.service" }}.redacted.nl`)'