Use of container to run the jobs/docker executor

I’d like to understand a bit more how runners in containers are working. When I try to set it up I am told to add this code in the yml file:

  image: ruby:2.7.4

however when running the pipeline it is stuck because I don’t have any runner available. Hence I create a container on my system, register it as a runner and it works.

When the pipeline runs it shows the log below. Then my question is : what is the the purpose of this ruby 2.7.4 image, what is it used for? Do we need to create another container for the executor?

I hope my question is clear


Preparing the "docker" executor 00:02 Using Docker executor with image ruby:2.7.4 ... Pulling docker image ruby:2.7.4 ... Using docker image sha256:69f25410a5ac7d4f6105bc831b44fe85d92935c6c78ab55134143821669c8c72 for ruby:2.7.4 with digest ruby@sha256:d1dbaf9665fe8b2175198e49438092fdbcf4d8934200942b94425301b17853c7 ...

If you are using the docker executor every step/stage of the pipeline is executed inside a container. The default image is the one to be used if you are not specifying an image for all the steps to be executed, also, it is possible to configure a default image when configuring the docker executor.