4

i have a problem with my CI Implementation...

I have a Jenkins Server installed and made a Build Pipeline. (Its from this tutorial: https://getintodevops.com/blog/building-your-first-docker-image-with-jenkins-2-guide-for-developers)

Here is a part of my Jenkinsfile:

stage('Build image') {
    app = docker.build("username/tag")
}

So when i run, i get the following error:

Touch Version 5.0 Copyright (c) 1995-2010 Embarcadero Technologies, Inc.
+ docker build -t username/tag .
Touch Version 5.0 Copyright (c) 1995-2010 Embarcadero Technologies, Inc.
Touch Version 5.0 Copyright (c) 1995-2010 Embarcadero Technologies, Inc.
Touch Version 5.0 Copyright (c) 1995-2010 Embarcadero Technologies, Inc.
error during connect: Post 
: open //./pipe/docker_engine: Das System kann die angegebene Datei nicht finden. 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.

I tested then this command:

stage('Build image') {
        sh 'eval $(docker-machine env default)'  
        app = docker.build("username/tag")
    }

And then i get this output:

Error checking TLS Connection: Host is not running

When i run

stage('Build image') {
        sh 'docker-machine ls'
        app = docker.build("username/tag")
    }

i get the following output:

NAME      ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER    ERRORS
default   -        virtualbox   Stopped                 Unknown 

But when i run 'docker-machine ls' on my local console, i get the following output:

NAME      ACTIVE   DRIVER       STATE     URL   SWARM   DOCKER    ERRORS
default   *        virtualbox   Running                 v18.09.0

So i dont know how to tell my Jenkins Server to use the local docker installation..

I have been searching for solutions for 2 days now and dont know how to solve it :/

I am using Docker ToolBox on a Windows 7 System. Jenkins is locally installed. NOT within a docker container.

Can someone please tell me what i am doing wrong?

snieguu
  • 2,073
  • 2
  • 20
  • 39
Steffen543
  • 81
  • 4

1 Answers1

3

I found a solution:

I had to add the environment variables to jenkins:

  • DOCKER_CERT_PATH
  • DOCKER_HOST
  • DOCKER_MACHINE
  • DOCKER_TLS_VERIFY
Steffen543
  • 81
  • 4