Docker executor: base image and .gitlab-ci.yml

Hi, I have read the docs carefully and I am still confused about this, it seems when you are using docker executor for a gitlab-runner you have two places to specify a base image:

  1. in the .gitlab-ci.yml, you specify the image on the top
  2. when registering the runner, you specify the base image and this is saved to the runner’s config.toml.

I am just wondering why there is two places to do this? How is this two related? Do they need to match each other?

Thansk a lot.