A failing RUN step in a build is hard to debug when the progress view redraws over the interesting part. I’d switch it to plain text.
docker build --progress=plain -t myimage .
The --progress option sets the type of progress output. The docs list these values: auto (the default, which uses tty if the client is a terminal and plain otherwise), tty (an interactive stream with colour and redrawing), plain (the raw build progress in plain text), quiet (suppress output and print the image ID on success, same as --quiet) and rawjson (raw progress as JSON lines). The options table also lists none, which the page does not describe further.
That auto rule means output that does not go to a terminal is already plain. The option is for the terminal in front of you, when you want to scroll back through everything a step printed.
The caveat is size. Plain output prints every step in full, so a big build can fill your scrollback. For a clean run I’d go back to the default, and I’d only use plain when I need to read what a step printed.
Further reading: docker buildx build: progress