make scratch a special case for build and pull

This PR makes `from scratch` a special case for `docker build` and it makes Docker not pull the image with the scratch ID. `scratch` is handled in `docker build` as well because this avoids triggering any pull code.

In both cases, it will just create an empty image with the same ID if it doesn't exist already.

This PR doesn't change push because the image which has scratch's ID won't get pulled from the registry.

Fixes #4242