Search code examples
docker-composegitlab-cigitlab-ci-runner

config.toml not created after registering runner


I am using docker-compose to create containers

version: '3.5'
services:
  gitlab:
    image: gitlab/gitlab-ce:latest
    hostname: 'localhost'
    restart: unless-stopped
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['gitlab_shell_ssh_port'] = 22
    ports:
      - "80:80"
      - "22:22"
    volumes:
      - D:/Projects/gitlab_data/data/docker/gitlab/etc/gitlab:/etc/gitlab
      - D:/Projects/gitlab_data/data/docker/gitlab/var/opt/gitlab:/var/opt/gitlab
      - D:/Projects/gitlab_data/data/docker/gitlab/var/log/gitlab:/var/log/gitlab
    networks:
      - gitlab_net

  gitlab-runner:
    image: gitlab/gitlab-runner:alpine
    restart: unless-stopped
    depends_on:
      - gitlab
    volumes:
      - D:/Projects/gitlab_data/data/docker/gitlab/etc/gitlab-runner:/etc/gitlab-runner
      - D:/Projects/gitlab_data/data/docker/gitlab/var/run/docker.sock:/var/run/docker.sock
    networks:
      - gitlab_net

networks:
  gitlab_net:

After that I register my runner

docker exec -ti gitlab_gitlab-runner_1 bash

gitlab-runner register

Enter the GitLab instance URL (for example, https://gitlab.com/):
http://gitlab:80
Enter the registration token:
GR13489411eYiYvPn5APgEwsXT9Eo
Enter a description for the runner:
[07d407440ddd]: runner
Enter tags for the runner (comma-separated):
runner
Enter optional maintenance note for the runner:

My runner appears in the web interface, but there is a problem, In the web interface, the runner is displayed with a warning: New runner, has not contacted yet

screenshot

i run gitlab-runner verify and after that i run gitlab-runner run But I am getting this error (config.toml really not created after registering runner):

listen_address not defined, metrics & debug endpoints disabled  builds=0
[session_server].listen_address not defined, session endpoints disabled  builds=0
ERROR: Failed to load config stat /etc/gitlab-runner/config.toml: no such file or directory  builds=0 ```

Solution

  • I'm wondering if using a Docker-managed Volume might resolve the issue, here.

    Try the following:

      gitlab-runner:
        ...
        volumes:
          - gitlab-runner-config:/etc/gitlab-runner
          - D:/Projects/gitlab_data/data/docker/gitlab/var/run/docker.sock:/var/run/docker.sock
        ...
    
    volumes:
      gitlab-runner-config:
    

    This tells Docker to mount the /etc/gitlab-runner path within the container to a volume named gitlab-runner-config.

    Re-register the runner after these changes, and report your results.


    Another possible solution is to try the Windows-based GitLab Runner executable: https://docs.gitlab.com/runner/install/windows.html