CICD caching of docker layers

We’re using the GitLab CI process to build our Docker images. We build from a mixture of .NET Core and Node/Angular.

I’m currently doing some layer caching manually using the following:

docker pull $CI_REGISTRY:build || true
docker build --target build \
    --cache-from $CI_REGISTRY:build
    --tag $CI_REGISTRY:build
    .
docker build --cache-from $CI_REGISTRY:build \
    --tag $CI_REGISTRY:$CI_COMMIT_SHA
    .

docker push $CI_REGISTRY

But for complex Dockerfiles, the command set can get unwieldly.

I can see from the documentation, that it’s possible to cache dependencies between builds, and that the path is defined in the .gitlab-ci.yml.

But, the documentation only refers to files that are stored on disk (node_modules, etc).

Is there a similar option for caching of Docker layers within the GitLab CI process, when using shared runners? Or is it better to setup private runners for this purpose?