Difference between "docker build FROM" and "docker pull"

Hello
I’ve got a question.

I run docker build on a Dockerfile with a curl base image:

FROM curlimages/curl:7.87.0

I thought that docker build would effectively perform something like docker pull curlimages/curl:7.87.0 when executing the FROM command.
But it doesn’t. If I run docker image ls afterwards it doesn’t outline curimages/curl:7.87.0. Adding the --pull option (docker build --pull) doesn’t make a difference.
This is unexpected for me. I would like to get a deeper understanding of docker build and why I doesn’t simply pull the requested curl image.

Background: we are struggling with docker pull rate limits and want to make use of a pull-through-cache as described here

to work around the limits.
We observe that e.g.docker pull curlimages/curl:7.87.0 leaves behind that curl image in the cache registry, as expected.
But docker build doesn’t. So whenever we execute some docker build we run into rate limit issues (sometimes not if our pull limit has refreshed).

I am working on a Windows 10 Enterprise (21H2) workstation with docker 20.10.22.
The registry that works as pull-through-cache is running on some Linux backend system.

Thanks in advance

docker build will pull the image layers but it will not set the tag automatically. on base image’s top layer. The --pull option would just make Docker pull an updated version of the image with the same tag in a Docker registry. It will still not set the tag. After you build your mage from Dockerfile and try to pull the base image you will see the following message:

7: Pulling from curlimages/curl
6717b8ec66cd: Already exists
Digest: sha256:be65f488b7764ad3638f236b7b515b3678369a5124c47b8d32916d6487418ea4
Status: Downloaded newer image for curlimages/curl:7.87.0
docker.io/curlimages/curl:7.87.0

Notice the “Already exists” part. This is when the tag will be set.