Docker GitLab CI不起作用

时间:2018-01-30 15:07:18

标签: docker gitlab gitlab-ci-runner gitlab-api

尝试使用CI运行器为gitlab发送docker容器。跑步者正在触发但每次我都

Using Docker executor with image phusion/baseimage ...
ERROR: Preparation failed: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

gitlab.ci.yml非常简单

stages:
- deploy

deploy_staging:
  stage: deploy
  image: phusion/baseimage
  script:
    - docker info
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
    - mkdir -p ~/.ssh
    - eval $(ssh-agent -s)
    - '[[ -f /.dockerenv ]] && echo -e "Host *ntStrictHostKeyChecking nonn" > ~/.ssh/config'
    - ssh-add <(echo "$STAGING_PRIVATE_KEY")
    - apt-get install rsync
    - ssh -p22 gituser@STAGING-DK02 "mkdir -p /html/themes/_tmp"

非常感谢任何帮助!

2 个答案:

答案 0 :(得分:0)

当我在没有提升权限的情况下运行任何docker命令时,我收到了该消息。

尝试使用前面的sudo运行命令。

答案 1 :(得分:0)

试试这个..

become_user: root

一些提示:

当shell为nologin时,以nobody用户身份执行某些操作:

- name: Run a command as nobody
  command: somecommand
  become: true
  become_method: su
  become_user: nobody
  become_flags: '-s /bin/sh'