Steven Luo
Steven Luo

Reputation: 2538

gitlab runner has no Internet connection

I have a Gitlab 15.1 deployed on EKS. The gitlab runner is also deployed on the same EKS using Helm. The configuration of the runner is as follow:

runners:
  config: |
    [[runners]]
      executor = "kubernetes"
      [runners.kubernetes]
        namespace = "{{.Release.Namespace}}"
        image = "ubuntu:16.04"
        [[runners.kubernetes.volumes.host_path]]
          name = "daemon"
          mount_path = "/var/run/docker.sock"
          read_only = true
          host_path = "/var/run/docker.sock"

The runner by default uses image registry.gitlab.com/gitlab-org/gitlab-runner:alpine-v15.1.0. I also use Gitlab Agent to connect to EKS. Both Gitlab runner and Gitlab agent connect to Gitlab successfully.

Mostly, the Gitlab CI/CD runner itself has Internet connection as I can docker login to private registry. However, the docker build commands in the .gitlab-ci.yaml fails due to lack of Internet connection. To find the cause, I run ifconfig in the Dockerfile, which only returns lo interface.

Upvotes: 0

Views: 1814

Answers (1)

Steven Luo
Steven Luo

Reputation: 2538

Turns out to be a problem of docker build. It happens in AWS Linux. Add --network=host solves the problem.

Upvotes: 1

Related Questions