I’ve a gitlab pipeline which looks like this:
stages:
- push
- deliver
port9070-image-push:
stage: push
tags:
- poc
- maifee
image: docker:stable
services:
- name: docker:dind
alias: docker
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
script:
- docker login -u $HARBOR_USERNAME -p $HARBOR_PASSWORD harbor.my-domain.bd
- docker build -t harbor.my-domain.bd/library/port9070:latest -f Dockerfile .
- docker push harbor.my-domain.bd/library/port9070:latest
only:
- dev
- main
This Git hosting is hosted in my domain, also the gitlab-runner is installed on my VPS for that domain. And I have already tested with a basic pipeline, which is working. But when I am trying to do some real world work with docker, it’s giving me error, saying: error during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on 192.168.0.222:53: server misbehaving
Full log:
[0KRunning with gitlab-runner 16.1.0 (b72e108d)[0;m
[0K on gitlab-runner-poc-maifee sY3VsxEP, system ID: s_635e67621e1e[0;m
section_start:1688377044:prepare_executor
[0K[0K[36;1mPreparing the "docker" executor[0;m[0;m
[0KUsing Docker executor with image docker:stable ...[0;m
[0KStarting service docker:dind ...[0;m
[0KPulling docker image docker:dind ...[0;m
[0KUsing docker image sha256:ad6479b49f1e99b76779e8d08bff4cf388cd23d435bf248337998905fcdf310e for docker:dind with digest docker@sha256:28c6ddb5d7bfdc019fb39cc2797351a6e3e81458ad621808e5e9dd3e41538c77 ...[0;m
[0;33mWARNING: Service docker:dind is already created. Ignoring.[0;m
[0KWaiting for services to be up and running (timeout 30 seconds)...[0;m
[0;33m*** WARNING:[0;m Service runner-sy3vsxep-project-96-concurrent-0-741eca69b02ef2fe-docker-0 probably didn't start properly.
Health check error:
start service container: Error response from daemon: Cannot link to a non running container: /runner-sy3vsxep-project-96-concurrent-0-741eca69b02ef2fe-docker-0 AS /runner-sy3vsxep-project-96-concurrent-0-741eca69b02ef2fe-docker-0-wait-for-service/service (services.go:187:0s)
Service container logs:
2023-07-03T09:37:26.216621307Z ip: can't find device 'ip_tables'
2023-07-03T09:37:26.221332586Z ip_tables 36864 0
2023-07-03T09:37:26.221522267Z x_tables 53248 7 xt_nat,xt_tcpudp,xt_conntrack,xt_MASQUERADE,xt_addrtype,nft_compat,ip_tables
2023-07-03T09:37:26.222908529Z modprobe: can't change directory to '/lib/modules': No such file or directory
2023-07-03T09:37:26.230877486Z mount: permission denied (are you root?)
2023-07-03T09:37:26.231056029Z Could not mount /sys/kernel/security.
2023-07-03T09:37:26.231072316Z AppArmor detection and --privileged mode might break.
2023-07-03T09:37:26.233428732Z mount: permission denied (are you root?)
[0;33m*********[0;m
[0KPulling docker image docker:stable ...[0;m
[0KUsing docker image sha256:b0757c55a1fdbb59c378fd34dde3e12bd25f68094dd69546cf5ca00ddbaa7a33 for docker:stable with digest docker@sha256:fd4d028713fd05a1fb896412805daed82c4a0cc84331d8dad00cb596d7ce3e3a ...[0;m
section_end:1688377051:prepare_executor
[0Ksection_start:1688377051:prepare_script
[0K[0K[36;1mPreparing environment[0;m[0;m
Running on runner-sy3vsxep-project-96-concurrent-0 via drone-io-01...
section_end:1688377051:prepare_script
[0Ksection_start:1688377051:get_sources
[0K[0K[36;1mGetting source from Git repository[0;m[0;m
[32;1mFetching changes with git depth set to 20...[0;m
Reinitialized existing Git repository in /builds/gitmhost/saas/pipeline-poc/.git/
[32;1mChecking out c0b3d7fd as detached HEAD (ref is dev)...[0;m
[32;1mSkipping Git submodules setup[0;m
section_end:1688377052:get_sources
[0Ksection_start:1688377052:step_script
[0K[0K[36;1mExecuting "step_script" stage of the job script[0;m[0;m
[0KUsing docker image sha256:b0757c55a1fdbb59c378fd34dde3e12bd25f68094dd69546cf5ca00ddbaa7a33 for docker:stable with digest docker@sha256:fd4d028713fd05a1fb896412805daed82c4a0cc84331d8dad00cb596d7ce3e3a ...[0;m
[32;1m$ docker login -u $HARBOR_USERNAME -p $HARBOR_PASSWORD harbor.my-domain.bd[0;m
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
error during connect: Post http://docker:2375/v1.40/auth: dial tcp: lookup docker on 192.168.0.222:53: server misbehaving
section_end:1688377053:step_script
[0K[31;1mERROR: Job failed: exit code 1
[0;m
I checked my system docker service is already running there. But for conveneince I have already added image
, service
etc. I don’t know how to resolve this issue.
I also tried this pipeline, this also didn’t work:
stages:
- push
- deliver
port9070-image-push:
stage: push
tags:
- poc
- maifee
variables:
DOCKER_TLS_CERTDIR: ""
script:
- docker login -u $HARBOR_USERNAME -p $HARBOR_PASSWORD harbor.my-domain.bd
- docker build -t harbor.my-domain.bd/library/port9070:latest -f Dockerfile .
- docker push harbor.my-domain.bd/library/port9070:latest
only:
- dev
- main
I have also modified the gitlab runner configuration file:
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "PoC runner - maifee"
url = "my.git.url"
id = 0
token = "xyz"
token_obtained_at = 0001-01-01T00:00:00Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.docker]
tls_verify = false
image = "docker:stable"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
How can I resolve this issue?