shorif2000
shorif2000

Reputation: 2654

docker runner on aws not running jobs

I am trying to set up a docker runner on aws ubuntu with the following commands

docker run -d --name gitlab-runner --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest

I have registered a runner on gitlab.com and I am using the following file

/srv/gitlab-runner/config/config.toml

concurrent = 1
check_interval = 0
log_level = "debug"

[session_server]
  session_timeout = 1800

[[runners]]
  name = "aws-qa"
  url = "https://gitlab.com/"
  token = "92SUvcbGzZcPziKX1B4d"
  executor = "docker+machine"
  listen_address="pipelines.domain.com:8043"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "docker:latest"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.machine]
    IdleCount = 0
    MachineDriver = ""
    MachineName = ""

It shows runner is active

$ sudo docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner verify - delete
Runtime platform                                    arch=amd64 os=linux pid=8 revision=c1edb478 version=14.0.1
Running in system-mode.

Verifying runner... is alive                        runner=92SUvcbG

But my jobs are always in paused state on gitlab.com. If I use shared runners they work.

In the logs I see builds=0 error=failed to update executor: missing Machine options executor=docker+machine runner=92SUvcbG

Upvotes: 2

Views: 679

Answers (1)

Breno W.
Breno W.

Reputation: 46

Update

This is occurring because docker+machine requires a virtualization driver (Docker, VMBox, VMWare, etc) to be installed on the system and set on the runner.

You then, need to specify both the installed driver + it's configuration. For example: let's say I'm using vmbox as my driver, then I need to check it's config and add them to my runner's TOML

Old answer

A bit late on this thread but wanted to document this for future readers.

One simple solution is to switch from docker+machine executor to docker. You can do that by editing the config.toml based on your configuration and system (see this)

If by any reason you can't do the above, here's a possible solution (tested on MacOS Monterey 12.4):

  1. Issue a sudo vi /etc/gitlab-runner/config.toml - note that this can differ based on where you installed the runner. Check the previous link to find the actual path to the file
  2. Add this MachineOptions = [ "engine-install-url=https://releases.rancher.com/install-docker/19.03.9.sh"] to your .toml file. You may exit the "vi" by pressing ESC and issuing :wq
  3. Check if the runner is properly loaded by issuing a sudo gitlab-runner verify

This problem seems to be related with newer versions of Docker while running the "machine" (deprecated) option. Reference: https://github.com/mawalu/hetzner-gitlab-runner/issues/6

If anyone has a better link to provide for the MachineOptions, feel free to edit this answer :)

Upvotes: -1

Related Questions