Jenkins Server with local docker

前提是你 提交于 2020-01-04 01:58:14

问题


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?


回答1:


I found a solution:

I had to add the environment variables to jenkins:

  • DOCKER_CERT_PATH
  • DOCKER_HOST
  • DOCKER_MACHINE
  • DOCKER_TLS_VERIFY


来源:https://stackoverflow.com/questions/54077205/jenkins-server-with-local-docker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!