Sobes.tech
Junior — Middle

What types of Docker Runners do you know and use in your projects?

sobes.tech AI

Answer from AI

In the context of GitLab CI/CD, Docker Runner is one of the types of runners that uses Docker to isolate and run tasks.

Main types of Docker Runners:

  • Docker executor — runs each job in a separate Docker container. It allows isolating the environment and easily managing dependencies.
  • Docker Machine executor — automatically creates and deletes virtual machines with Docker, scaling runners as needed.

In projects, the Docker executor is most commonly used because it is easy to set up and provides task isolation. For example, you can specify a Docker image in which the job will run, which is convenient for testing and building.

Example configuration of Docker executor in .gitlab-ci.yml:

job:
  image: golang:1.18
  script:
    - go test ./...

Here, the job runs in a container with the golang image.