sacarr
sacarr

Reputation: 101

Docker GitLab CI Not Working

Trying to ship a docker container for gitlab using CI runners. The runner is triggering but each time I get

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?

The gitlab.ci.yml is very simple

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"

Any help would be very much appreciated!

Upvotes: 1

Views: 559

Answers (2)

envalentine
envalentine

Reputation: 531

try this..

become_user: root

some tips:

To do something as the nobody user when the shell is nologin:

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

Upvotes: 1

Ian A McElhenny
Ian A McElhenny

Reputation: 1027

I have gotten that message when I ran any docker command without elevated permission.

Try running the command with sudo in front.

Upvotes: 1

Related Questions