Gitlab runner does not have access to internet

Describe your question in as much detail as possible:
How can I get the gitlab runner to connect to the internet? Any job I build that would need to connect to the internet doesn’t work. Always either connection timeout or failed when I run docker build

  • What are you seeing, and how does that differ from what you expect to see?

  • Consider including screenshots, error messages, and/or other helpful visuals

  • What version are you on? Are you using self-managed or

    • GitLab (Hint: /help): Latest
    • Runner (Hint: /admin/runners): Latest
  • Add the CI configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml)

image: docker:19.03.0

  DOCKER_DRIVER: overlay2
  DOCKER_HOST: tcp://localhost:2375/

  - docker:19.03.0-dind
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?
    Upgraded runner and gitlab to the latest version


Sorry to hear you’re having problems getting this to work.

Please can you provide more info, ideally some or all of the failing job logs?

  • The start of the output would provide the runner version (more below).
  • Seeing that you can pull the git repo (and maybe where from) gives some sort of indication of connectivity from the runner.
  • Seeing that you can pull a container (and where from) similarly gives a clue about connectivity.
  • The actual output of the attempted activity complete with the actual errors gives us loads of context about what your job is doing and exactly how it is failing. If its an error relating to resolving a internet hostname in DNS, that’s a different problem than if it proceeds to connect and never gets there. IF it’s a TLS error, that’s different again.
  • Seemingly innocuous warnings or errors prior to the hard failure might actually explain the issue.

Also, please elaborate further:

  • “when I run docker build” - are you building containers in your jobs? So, is this a failure pulling the base container for what you’re building? An excerpt of your GitLab CI config might be really helpful.
  • Where is your runner? In a private datacentre, in AWS ? Do you connect to the internet via a proxy?
  • The actual versions of GitLab and the runner please, not ‘latest’. This will help other GitLab users who come by with the same issue, if it was version specific. And it’s July 22nd today, so there’ll be new releases today and ‘Latest’ will have changed.

thanks, Ben

1 Like

Hello Ben,

Gitlab version is:
Runner version is 13.0.1

I did some investigation, I think it’s only the docker during the build process that doesn’t connect to the internet.

Yes, I’m building images during the build ci jobs. The runner lives in K8S cluster. I’ll try to check for some more information and get back to you.

Thanks @bprescott