问题
I'm trying to set up gitlab CI on a windows 10 PC.
I have created a docker container for gitlab (volumes are docker volumes)
docker run --detach --name gitlab --hostname gitlab.mod --publish 4443:443 --publish 4480:80 --publish 8222:22 --volume gitlab-conf:/etc/gitlab --volume gitlab-logs:/var/log/gitlab --volume gitlab-data:/var/opt/gitlab gitlab/gitlab-ce
Another for the runner
docker run -d --name gitlab-runner -v gitlab-runner-conf:/etc/gitlab-runner gitlab/gitlab-runner:latest
registered
docker run --rm -t -i -v gitlab-runner-conf:/etc/gitlab-runner gitlab/gitlab-runner register --url "http://11.22.33.44:4480/" --registration-token "sEcrEttOkEnfOrgItlAb" --description "Runner" --executor "docker" --docker-image alpine:latest --docker-services postgres:latest
where 11.22.33.44 is the IP of my computer
But when I push my commits, i have an error
Running with gitlab-runner 12.5.0
on Runner
ERROR: Job failed (system failure): Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (executor_docker.go:980:0s)
If I set parameters to expose docker on port 2375 :
settings > General > Expose daemon on tcp://localhost:2375
And in /etc/gitlab-runner/config.toml in the runner container :
[runners.docker]
host = "tcp://11.22.33.44:2375"
I have nearly the same error message :
Running with gitlab-runner 12.5.0 (577f813d)
on Runner
ERROR: Job failed (system failure): Cannot connect to the Docker daemon at tcp://11.22.33.44:2375. Is the docker daemon running? (executor_docker.go:980:1s)
I don't understand from where this comes from. I have tried some solutions found on internet but till now, nothing worked.
Where can i find some log file to see what happens ? I've looked in the gitlab container /var/log/gitlab log files but I can't find any about details between the 2 containers.
Is there problems between the gitlab hostname, the "localhost" name, the computer IP ? A firewall somewhere ? Is this a problem similar to all those i've seen around ? Does the runner gets the jobs he has to execute but gitlab doesn't hear the answer ?
Most of things i tried so far made the situation getting worst and i would need some hint
My .gitlab-ci.yml (very simple) :
variables:
HELLO: World
test:
script:
- echo $HELLO
My config
Docker Desktop Community edition 2.0.0.3 (Engine 18.09.2)
GitLab Community Edition 12.5.2
Gitlab Runner 12.5.0
Windows 10.0.17763
Thanks
回答1:
If your goal is to register a docker executor, one simple way is to run a command gitlab-runner.exe register
and follow interactive instructions, it will fill up your config.toml
This error also appears when you try to use docker in docker image as you runner image to execute docker commands.
In that case a used runner tag, must have a privileged set to true and in your gitlab-ci file you may define a variable DOCKER_DRIVER: overlay
or DOCKER_DRIVER: overlay2
回答2:
This seems to be solved by
Configuring the runner (/etc/gitlab-runner/config.toml) :
[[runners]]
[runners.docker]
host = "tcp://docker.for.win.localhost"
...
or
[[runners]]
[runners.docker]
host = "tcp://10.0.75.1"
...
I say seems because I still have errors (but not the same) => ERROR: Preparation failed: Error response from daemon: The requested URL /v1.25/info was not found on this server
来源:https://stackoverflow.com/questions/59422889/error-job-failed-system-failure-cannot-connect-to-the-docker-daemon-at-unix