- docker:dind
before_script:
- docker login -u “$CI_REGISTRY_USER” -p “$CI_REGISTRY_PASSWORD” $CI_REGISTRY
Default branch leaves tag empty (= latest tag)
All other branches are tagged with the escaped branch name (commit ref slug)
script:
if [[ “$CI_COMMIT_BRANCH” == “$CI_DEFAULT_BRANCH” ]]; then
tag=""
echo “Running on default branch ‘$CI_DEFAULT_BRANCH’: tag = ‘latest’”
tag=":$CI_COMMIT_REF_SLUG"
echo “Running on branch ‘$CI_COMMIT_BRANCH’: tag = $tag”
- docker build --pull -t “$CI_REGISTRY_IMAGE${tag}” .
- docker push “$CI_REGISTRY_IMAGE${tag}”
Run this job in a branch where a Dockerfile exists
rules:
- if: $CI_COMMIT_BRANCH
exists:
- Dockerfile
docker-compose.yml:
version: ‘3.3’
services:
gitlab:
image: ‘gitlab/gitlab-ce:latest’
restart: always
hostname: ‘gitlab.rimed.cu’
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url ‘
https://gitlab.rimed.cu
’
ports:
- ‘80:80’
- ‘443:443’
volumes:
- ‘/volumenes/gitlab/config:/etc/gitlab’
- ‘/volumenes/gitlab/logs:/var/log/gitlab’
- ‘/volumenes/gitlab/data:/var/opt/gitlab’
gitlab-runner:
image: gitlab/gitlab-runner:latest
restart: always
volumes:
- ./runner/:/etc/gitlab-runner/
- /var/run/docker.sock:/var/run/docker.sock
logs del job:
Running with gitlab-runner 14.6.0 (5316d4ac)
on runner docker XewrByYu
Preparing the "docker" executor
Using Docker executor with image docker:latest ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image sha256:175122d895c3ac2d1a9e3eeaa4885972ffcf3cf86c6e14261fd58db58ca77139 for docker:dind with digest docker@sha256:1f50d3a86f7035805843779f803e81e8f4ce96b62ed68fc70cdcf4922f43470b ...
Waiting for services to be up and running...
*** WARNING: Service runner-xewrbyyu-project-41-concurrent-0-bd61a31b8675d6bf-docker-0 probably didn't start properly.
Health check error:
service "runner-xewrbyyu-project-41-concurrent-0-bd61a31b8675d6bf-docker-0-wait-for-service" timeout
Health check container logs:
Service container logs:
2022-05-25T18:45:56.010062491Z time="2022-05-25T18:45:56.009614571Z" level=info msg="Starting up"
2022-05-25T18:45:56.013861427Z time="2022-05-25T18:45:56.013331999Z" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
2022-05-25T18:45:56.013895692Z failed to load listeners: can't create unix socket /var/run/docker.sock: device or resource busy
*********
Pulling docker image docker:latest ...
Using docker image sha256:15a9bc7c6340df2ac9d6c8196ca1d905180ddf2ca8b29a8d98f5422e2e5ccf85 for docker:latest with digest docker@sha256:a729cce205a05b0b86dc8dca87823efaffc3f74979fe7dc86a707c2fbf631b61 ...
Preparing environment 00:01
Running on runner-xewrbyyu-project-41-concurrent-0 via c2ffb07654f2...
Getting source from Git repository 00:02
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/backend/gobart-api/.git/
Checking out 9a645922 as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script 00:01
Using docker image sha256:15a9bc7c6340df2ac9d6c8196ca1d905180ddf2ca8b29a8d98f5422e2e5ccf85 for docker:latest with digest docker@sha256:a729cce205a05b0b86dc8dca87823efaffc3f74979fe7dc86a707c2fbf631b61 ...
$ docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
error during connect: Post "http://docker:2375/v1.24/auth": dial tcp: lookup docker on 200.55.156.165:53: no such host
Cleaning up project directory and file based variables
ERROR: Job failed: exit code 1
Thanks for taking the time to be thorough in your request, it really helps!
As you can see from your Job log, your
docker:dind
service failed to start so there is no
docker
to connect to.
I would say your error is related to
this
.
Thanks for the cache recommendation, also tried this before the post and had the same result.
this is the runner config
runner/config.toml
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = “runner docker”
url = “
https://gitlab.rimed.cu/
”
token = “XewrByYuQrfYpUg_opSw”
executor = “docker”
[runners.custom_build_dir]
[runners.docker]
tls_verify = false
image = “docker:latest”
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock", “/cache”]
shm_size = 0
and the issues persist.
thanks
I tried this fix, but when binding the socket lost connection with dockerd.
docker info
Client:
Context: default
Debug Mode: false
Server:
ERROR: error during connect: Get "http://docker:2375/v1.24/info": dial tcp: lookup docker on 200.55.156.165:53: no such host
also tried:
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = “runner docker”
url = “
https://gitlab.rimed.cu/
”
token = “XewrByYuQrfYpUg_opSw”
executor = “docker”
[runners.custom_build_dir]
[runners.docker]
tls_verify = false
image = “docker:latest”
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock", “/cache”]
shm_size = 0
cap_add = ["SYS_ADMIN"]
devices = ["/dev/fuse"]
security_opt = ["apparmor:unconfined"]
the runner status is ok
gitlab-runner verify
Runtime platform arch=amd64 os=linux pid=241 revision=5316d4ac version=14.6.0
Running in system-mode.
Verifying runner... is alive runner=XewrByYu
but the issue persists