Build docker image in CI/CD with a Dockerfile that has FROM registry.gitlab.com/foo

I am using dind in my CI job and building docker images successfully.

As an idea I wondered if I pushed docker images to our container registry and then change the Dockerfile from:

FROM node

to

FROM registry.gitlab.com/mygroup/infrastructure/docker-images/node

it might speed our build times up, but by using this approach it always errors with a 403 even though I logged into the registry before calling docker build

Is this even possible and would it speed up builds?

What does CI show when you docker pull registry.gitlab.com/mygroup/infrastructure/docker-images/node ?