BasicAuth -- The "e6VrNv" variable is not set

I am attempting to serve the Trafik dashboard with basic Auth and am getting the following error:

WARN[0000] The "e6VrNv" variable is not set. Defaulting to a blank string.
traefik:
    image: "traefik:v2.10"
    container_name: "traefik"

    labels:
      - "traefik.http.middlewares.test-auth.basicauth.users=user1:$$2b$05$e6VrNv.t8F4C5CAeztQNkeO9Y5CjzTgCZKcWdF3CBmy/tZs20mkpS,user2:$$2b$05$e6VrNv.t8F4C5CAeztQNkeO9Y5CjzTgCZKcWdF3CBmy/tZs20mkpS"
      - "traefik.http.routers.api.rule=Host(`traefik.MyDomain.com`)"
      - "traefik.http.routers.api.service=api@internal"
      - "traefik.http.routers.api.middlewares=auth"

    command:
      #- "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.myresolver.acme.dnschallenge=true"
      - "--certificatesresolvers.myresolver.acme.dnschallenge.provider=cloudflare"
      #- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      - "--certificatesresolvers.myresolver.acme.email=postmaster@wwwmri.com"
      - "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    environment:
      - CLOUDFLARE_EMAIL=MyEmail@gmail.com
      - CLOUDFLARE_DNS_API_TOKEN=MyToken
    volumes:
      - "./letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

  web1:
    image: nginx:latest
    container_name: "web1"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.web1.rule=Host(`web1.MyDomain.com`)"
      - "traefik.http.routers.web1.entrypoints=websecure"
      - "traefik.http.routers.web1.tls.certresolver=myresolver"
    volumes:
      -  ./index1.html:/var/www/websites/index.html
      -  ./default.conf:/etc/nginx/conf.d/default.conf

How and where do I add the environment variables?

In labels you always need to escape $ with another $, so it’s always $$.

Good Eye.
I escaped the first $ but missed the rest.
That fixed the

WARN[0000] The "e6VrNv" variable is not set. Defaulting to a blank string.

the site now shows a security lock

Unfortunately Cloudflare is giving me

 Invalid SSL certificate Error code 526 

And I can not access the dashboard via MyDomain.com

Traefik dashboard needs to be enabled (doc) and you need to use the same name: you create test-auth middleware and assign non-existing auth middleware.

Maybe check simple Traefik example.

Error 526 is an SSL certificate error that occurs when Cloudflare cannot verify the SSL certificate presented by the origin server.

Maybe that fixes it. If not, share your full Traefik static and dynamic config, and docker-compose.yml if used.