DNS settings get reset in docker

This looks like a common problem and I'm not sure if there's already a solution to it. This is how I have the docker container configured, very simple:

pihole:
    image: pihole/pihole:v5.2.1
    container_name: pihole
    hostname: pihole.condo.arpa
    volumes:
      - /home/kevin/appdata/pihole/etc-pihole:/etc/pihole
      - /home/kevin/appdata/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
      - /home/kevin/appdata/proxy/wpad.dat:/var/www/html/wpad.da
      - /home/kevin/appdata/proxy/wpad.dat:/var/www/html/wpad.dat
      - /home/kevin/appdata/proxy/wpad.dat:/var/www/html/proxy.pac
    mac_address: fa:af:f7:2e:f5:97
    networks:
      physical_macvlan_network:
        ipv4_address: 192.168.20.100
    dns:
      - 127.0.0.1
      - 8.8.4.4
    restart: unless-stopped
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=Asia/Manila

Everytime I enable DNSSEC and configure conditional forwarding, they get reset every after container restart. This seems to be a very common issue and I'm surprised it's not fixed until now. Do I have to "force" the values of these DNS settings by using all the environment variables for them? Clearly, these variables are marked as "optional" so why do I need to be using them to be able to set my DNS settings? It's kinda counterproductive, no?

Also, I know that to be able to use multiple conditional forwarders, I need to manually edit dnsmasq.d. But how will even achieve that if everything after restart that config file is written with a fresh copy?

Nevermind! I updated to 5.3.4 and it solved the issue.

where did you get that version? I'm using latest and my version is v5.25.2. Sorry for using an old post

At this point, I don't really remember. Sorry.

This is a very old topic.
At that time the images were named using the core Pi-hole version. That compose file was using a docker image with tag pihole/pihole:v5.2.1.

The tag naming was changed around 3 years ago.
Now our images use a date-based format - AAAA.MM.N - where AAAA is the year of the image release, MM is the month and N is a sequential number.

All image tags can be found in: