Can you confirm which version of LocalStack are you running and share a log snippet?
Dotnet8 is supported and your template looks correct, but it could be that you have an old LocalStack version cached.
With LocalStack running, can you also check the output on this URL and see if dotnet8 is listed?
http://localhost.localstack.cloud:4566/_aws/lambda/runtimes