Dockerfile RUN gradle dist --no-daemon error

I have error in Dockerfile. The problem command is RUN gradle dist --no-daemon. The error is Task ‘dist’ not found in root project ‘fxgame’ and failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c gradle dist --no-daemon]: runc did not terminate sucessfully. The run command is RUN gradle dist --no-daemon

link to stack overflow my question