[SOLVED] Uploading Artifacts fails with "no such host" on Dockerized Gitlab installation with Traefik

Dear all,
I installed self hosted Gitlab CE using docker with traefik as a reverse proxy. However, when the gitlab runner tries to upload artifacts back to gitlab the following error appears:

Uploading artifacts...
*.pdf: found 1 matching files and directories      
ERROR: Uploading artifacts as "archive" to coordinator... error  error=couldn't execute POST against http://gitlab/api/v4/jobs/21/artifacts?artifact_format=zip&artifact_type=archive: Post http://gitlab/api/v4/jobs/21/artifacts?artifact_format=zip&artifact_type=archive: dial tcp: lookup gitlab on 213.133.98.98:53: no such host id=21 token=woxUczp2
WARNING: Retrying...                                context=artifacts-uploader error=invalid argument

The gitlab and gitlab-runner containers are in the same docker network, and CURLing http://gitlab/api/v4/jobs from the gitlab-runner container shows {“message”:“403 Forbidden”}, so the address resolution seems to work.

I also tried using the full git domain (git.example.io) instead of the containers hostname when setting up a runner, but since the runner seems to send tcp requests and not http requests, traefik does not know where to route them.

Would appreciate any help with this, thanks

Update: I also tried using the full hostname + network (gitlab.gitlab_gitlab) and the current internal IP of gitlab (the one that shows when pinging gitlab from the runner-container) and nothing worked

SOLUTION:
I added

network_mode="<docker_network_here>"

to the end of the runner definitions in the gitlab-runner config.toml. Now it works.

1 Like