Fix problem where building Dockerfile `FROM name:latest`

Fixes #8692 

Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)