Hi,
Mendix Docker Buildpack relies on Mendix CF Buildpack script.
According to the Readme on CF repository, you can enable option to use Java 21 by passing the JAVA_VERSION environment variable during docker build
For example
ENV JAVA_VERSION=21
https://github.com/mendix/cf-mendix-buildpack?tab=readme-ov-file#java-version
However, you may need to recheck if your mendix version already support Java 21 or not.
Hope this help!