False positive SonarLint/SonarQube rule docker:S6596 with multi-stage docker builds

Hello @javanegmond,
thanks for reporting this issue!

You’re right, the rule S6596 shouldn’t raise in this case.
We normally don’t raise on references to previous build stages.
In your case the image of the referenced build stage was unresolvable to us because of the ${PRIVATE_REGISTRY}. In these cases, we did miss to register the alias.

I created a ticket to fix this issue, which can be viewed here:
SONARIAC-1418 - S6596 should not raise on references to previous build stages when previous stage is unresolvable

Best,
Jonas