Verifying modules and error 504 Gateway Time-out

That message comes from Apache, or potentially any reverse proxy you have in front of the containers.

CMS_APACHE_TIMEOUT will increase the Apache setting if you put it in config.env or docker-compose.yml and restart the containers.

For reference, I think this is the other topic mentioned. Verify Module error 504 Gateway Time-out

Alternatively verify modules runs during Daily Maintenance, so you could set that task to Run Now and let XTR run it for you.