Can't connect to MySQL server on '127.0.0.1' in Docker setup (Frappe v15)

I’m trying to set up ERPNext v15 using Frappe Docker with the official frappe_docker repository. The containers start successfully, but I keep getting an Internal Server Error when accessing the site.

When I run this:
docker compose exec backend bench --site erp3.critontech.com list-apps

I get the following error:

pymysql.err.OperationalError: (2003, “Can’t connect to MySQL server on ‘127.0.0.1’ ([Errno 111] Connection refused)”)

:gear: Setup Information

OS: Ubuntu 22.04 (host)
Docker Compose:Yes (using frappe_docker ERPNext version: v15 MariaDB Version: 10.6 Traefik: Enabled Site Name:** example.com`
What I Tried

Added "db_host": "db" in site_config.json
Restarted backend container: docker compose restart backend
Still getting the same error on bench commands and site gives “Internal Server Error”