A similar issue was reported in Sonar-scanner fails to scan C code, though the environment is different, not to mention running in Docker. @mpaladin, with regard to the solution there, might there be a command we can use for additional debugging?
I removed the timestamps from the successful and failing logs to try to further isolate where/how things are going wrong. The good log has several instances of compiler probing that are missing from the bad log, but this probably doesn’t tell us anything new. I’ll see if I can attach the logs in a private chat.