Dns not working on selfhost with docker

It’s working fine with IP but I have problem when change the dns setting and config host file from my local trying to access to domain it wont work and got 504 Gateway Time-out

Please clarify, is this domain name that you provided resolved normally on the server and in Docker container?

You can check this by running nslookup onlyoffice.amaracapital.com command on the host and in some container (for example, login container). Send us the output.
Also, send us the output of this command: curl --location http://onlyoffice.amaracapital.com/api/2.0/capabilities (from the container)