Docker Community Forums

Share and learn in the Docker community.

Running jobs locally with GitLab Runner using powershell on windows

Hi All,

I’m having problems running jobs locally with gitlab runner using power shell on windows 10 pro in the command prompt ( I run the command prompt as an administrator ). I have installed docker toolbox (version:19.03.1) and gitlab runner ( version:12.5.0). I have registered a gitlab-runner and gitlab-ci.yml file configured in the project root folder.

When I tried to execute job gitlab-runner exec docker maven-build command locally after starting the gitlab-runner service. I got this error:

ERROR: Preparation failed: error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running. (executor_docker.go:980:0s)

These are the settings I’m running:

config.toml:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "my-runner"
  url = "https://gitlab.com/"
  token = "XXXXXXXXXXXXXX"
  executor = "docker"
  [runners.custom_build_dir]
  [runners.docker]
    tls_verify = false
    image = "alpine:latest"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]

.gitlab-ci.yml:

image: docker:latest
services:
  - docker:dind

variables:
  DOCKER_DRIVER: overlay
  SPRING_PROFILES_ACTIVE: gitlab-ci

stages:
  - build
  - package
  - deploy

maven-build:
  image: maven:3-jdk-8
  stage: build
  script: "mvn package -B"
  artifacts:
    paths:
      - target/*.jar

docker-build:
  stage: package
  script:
  - docker build -t registry.gitlab.com/xxxx/xxxxx .
  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
  - docker push registry.gitlab.com/xxxx/xxxxx
  
docker-deploy:
  stage: deploy
  script:
  - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
  - docker pull registry.gitlab.com/xxxx/xxxxx
  - echo $DOCKER_HOST
  - echo $CI_SERVER_HOST
  - docker run -itd --name test -p 9090:8080 registry.gitlab.com/xxxx/xxxxx sh
  - docker inspect test

Please help.

Thanks in advance!