Fix pull for official images

When pulling official images (no user namespace) with a given tag (e.g. `docker pull ubuntu:12.04`), registry failed with error 404 when trying to retrieve the image ID associated with this tag. This patch fixes it.