November 22, 2017

[SOLVED][gitlab-ci-multirunner] Cannot connect to the Docker daemon at unix:///var/run/docker.sock




Two errors you can fix like that

#1 set privileged = true

2017-11-21T15:17:26.802822881Z mount: permission denied (are you root?)
2017-11-21T15:17:26.803090353Z Could not mount /sys/kernel/security.
2017-11-21T15:17:26.803107368Z AppArmor detection and --privileged mode might break.
2017-11-21T15:17:26.806984781Z mount: permission denied (are you root?)


#2 Mount /var/run/docker.sock as a volume

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?




/etc/gitlab-runner/config.toml


concurrent = 4
check_interval = 0

[[runners]]
  limit = 4
  name = "fancy name"
  url = "https://www.gitlab.com"
  token = "secret token"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "alpine:3.4"
    privileged = true
    disable_cache = false
    volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"]
  [runners.cache]
    Insecure = false

November 21, 2017

[SOLVED]"[: 1: [: Syntax error: end of file unexpected"



If you getting
"[: 1: [: Syntax error: end of file unexpected" 
in gitlab while executing jobs in under .gitlab-ci.yml
check if your entrypoint.sh of the Docker image you using in this job.


Wrong:
exec $@


Right:
exec "$@"


Source: https://docs.docker.com/engine/reference/builder/#exec-form-entrypoint-example