Gitlab-Runner中的Docker Executor中的Docker不起作用(无法连接到docker deamon)

时间:2017-10-05 10:49:07

标签: sockets docker gitlab gitlab-ci-runner

所以我最近尝试过Docker和Gitlab Runner,但似乎我无法让它工作。

这是我的日志:

Running with gitlab-runner 10.0.2 (a9a76a50)
on my-docker (c588e5e2)
Using Docker executor with image docker:git ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
Using docker image docker:dind   ID=sha256:b9145b364a203c0afc538ca615b3470e41729edfb7338017f5d4eeb5b13b2d90 for docker service...
Waiting for services to be up and running...
Using docker image sha256:7961fbf38d6f827265aed22fe41a1db889c54913283b678a8623efdda9573977 for predefined container...
Pulling docker image docker:git ...
Using docker image docker:git ID=sha256:5917639be9495ab183f357e8bafafea82449f0c4b12b745eef8bd23d474220ca for build container...
Running on runner-c588e5e2-project-1-concurrent-0 via gitlabServer...
Cloning repository...
Cloning into '<Project name>'...
Checking out ed0ce69e as master...
Skipping Git submodules setup
$ # Auto DevOps variables and functions # collapsed multi-line command
$ setup_docker
$ build
Building Heroku-based application using gliderlabs/herokuish docker image...
**docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.**
See 'docker run --help'.
ERROR: Job failed: exit code 125

可能是什么错误? Docker本身正在运行,但是里面的docker似乎没有用。

这是我的.toml文件:

[[runners]]
  name = my name
  url = my url
  token = my token
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "docker:latest"
    privileged = true
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]

提前感谢您的帮助!

编辑:那是什么&#34; docker ps&#34;作为输出:

ED             STATUS                  PORTS               NAMES
e66e844481b7        7961fbf38d6f                  "gitlab-runner-ser..."   2 sec                                                                                                                               onds ago       Up Less than a second                       runner-73520410-proje                                                                                                                               ct-1-concurrent-0-docker-0-wait-for-service
4f659dba7bac        b9145b364a20                  "dockerd-entrypoin..."   2 sec                                                                                                                               onds ago       Up 1 second             2375/tcp            runner-73520410-proje                                                                                                                               ct-1-concurrent-0-docker-0
73776d4638b9        gitlab/gitlab-runner:latest   "/usr/bin/dumb-ini..."   19 mi                                                                                                                               nutes ago      Up 19 minutes                               gitlab-runner

编辑2:我的gitlab-ci.yaml

#ruby 2.2
rspec:ruby2.2:
  image: ruby:2.2
  script:
    - bundle exec rspec spec
  tags:
    - ruby
  except:
    - tags

#ruby 2.1
rspec:ruby2.1:
  image: ruby:2.1
  script:
    - bundle exec rspec spec
  tags:
    - ruby
  except:
    - tags

.go: &go_definition
  before_script:
  - apt-get update -qq && apt-get install -y ruby
  - ruby -v
  script:
    - go version
    - which go
    - bin/compile
    - support/go-test
    - support/go-format check

go:1.8:
  <<: *go_definition
  image: golang:1.8

codeclimate:
  before_script: []
  image: docker:latest
  variables:
    DOCKER_DRIVER: overlay
  services:
    - docker:dind
  script:
    - docker pull codeclimate/codeclimate
    - docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code    --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze -f json > codeclimate.json
  artifacts:
    paths: [codeclimate.json]

0 个答案:

没有答案