带有本地Docker的Jenkins Server [英] Jenkins Server with local docker

查看:188
本文介绍了带有本地Docker的Jenkins Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的CI实施有问题...

i have a problem with my CI Implementation...

我安装了Jenkins服务器,并建立了构建管道. (摘自本教程: https://getintodevops.com/blog/building-your-first-docker-image-with-jenkins-2-guide-for-developers )

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)

这是我的Jenkinsfile的一部分:

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.

我测试了以下命令:

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

然后我得到以下输出:

Error checking TLS Connection: Host is not running

当我跑步

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

我得到以下输出:

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

但是当我在本地控制台上运行"docker-machine ls"时,得到以下输出:

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

所以我不知道如何告诉我的Jenkins服务器使用本地docker安装.

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

我已经寻找解决方案已有2天了,不知道如何解决:/

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

我在Windows 7系统上使用Docker ToolBox. Jenkins已本地安装.不在Docker容器中.

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?

推荐答案

我找到了解决方法:

我必须将环境变量添加到jenkins:

I had to add the environment variables to jenkins:

  • DOCKER_CERT_PATH
  • DOCKER_HOST
  • DOCKER_MACHINE
  • DOCKER_TLS_VERIFY

这篇关于带有本地Docker的Jenkins Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆