Search code examples
dockergitlabgitlab-ci-runnergitlab-api

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!


Solution

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

    Try running the command with sudo in front.