but it doesn’t worked
So many details.
Why not use some type of “network info tool” app to find out which DNS servers are actually being used and what their replies are?
Android is well known of often sneaking in the Google DNS servers (8.8.8.8 and 8.8.4.4 for IPv4) if you only enter one DNS server in the network options of your WLAN. Place your own DNS into both fields. Some Android ROMs complain then that they are identical, in that case try to enter 127.0.0.1 or 0.0.0.0 for example as one, if that also doesnt work then just make up another IP that fits your network. It will send requests into nowhere but since the other one is working, it doesnt matter much.
A lot of Android ROMs also have “Private DNS” enabled by default. Disable that, it might be the reason its bypassing your local DNS (Pihole, Adguard Home, whatever).
And some users mistakenly enter their own local DNS (like a Pihole) into the “Private DNS” option.
What is also possible is that some apps have their own builtin “by-pass”, for example they might use DNS-over-TLS or DNS-over-HTTPS (DoT/DoH) to make encrypted DNS requests to fixed servers, completely ignoring whatever you set in the OS network config.
/r/Android and /r/HomeNetworking can help.
Plenty of guides exist on how to use Portainer to deploy a compose file.
You can also ask in /r/Portainer for help i guess.