Frappe Docker AttributeError: 'Cursor' object has no attribute '_last_executed'

I am getting the below error
AttributeError: ‘Cursor’ object has no attribute ‘_last_executed’. Did you mean: ‘_check_executed’?

While creating a new site.

The image is built using https://github.com/castlecraft/custom_containers/tree/main/ci

below are the build environments we used

FRAPPE_REPO=GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript
FRAPPE_VERSION=v14.21.0
PY_VERSION=3.10.5
NODEJS_VERSION=16.18.0
CONTEXT=git://github.com/frappe/frappe_docker
DOCKERFILE=images/custom/Containerfile

and below are the apps

[
{
“url”: “GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)”,
“branch”: “v14.12.0”
},
{
“url”: “GitHub - frappe/payments: A payments app for frappe”,
“branch”: “version-14”
},
{
“url”: “GitHub - frappe/hrms: Open Source HR and Payroll Software”,
“branch”: “version-14”
},
{
“url”: “GitHub - frappe/lms: Easy to Use, 100% Open Source Learning Management System”,
“branch”: “main”
}

]

The stack is setup using https://github.com/castlecraft/custom_containers/blob/main/docs/docker-swarm.md

Please could someone help to resolve the error