Gitlab runner docker Could not resolve host

后端 未结 4 692
半阙折子戏
半阙折子戏 2021-01-04 17:32

Im using 2 containers on my Ubuntu OS: Gitlab-ce and gitlab-runner

Containers names are: gitlab_gitlab_1 and gitlab_gitlab-runner_1

I

4条回答
  •  庸人自扰
    2021-01-04 18:35

    Thanks to Tarun Lalwan link and according to Joyce Babu post, there are an undocumented option from the gitlab runner repos in the [runners.docker] section

    network_mode : Add container to a custom network
    

    So I have to set this option with my network name in the config.toml like

    [[runners]]
      ...
      [runners.docker]
        ...
        network_mode = "gitlab_default"
    

    OR when create the runner from command line

    docker exec -it gitlab_gitlab-runner_1 gitlab-runner register \
    --non-interactive \
    --url http://gitlab_gitlab_1 \
    --registration-token _wgMgEx3nBocYQtoi83c \
    --executor docker \
    --docker-image alpine:latest \
    --docker-network-mode gitlab_default
    

提交回复
热议问题