我按照本教程在dockers:https://jenkins.io/doc/tutorials/building-a-java-app-with-maven/#fork-and-clone-the-sample-repository-on-github中使用jenkins构建了一个hello-world maven java应用程序。
这是我的应用程序(只需从教程中分叉):简单-java-maven-app
它有一个小的区别,我在管道的选项(Repository )中使用的是远程回购(Github),而不是本地回购(或主机回购)。我把Jenkinsfile推到repo,然后用管道构建hello-world应用程序。
// Jenkinsfile for Pipeline
pipeline {
agent {
docker {
image 'maven:3-alpine'
args '-v /root/.m2:/root/.m2'
}
}
stages {
stage('Build') {
steps {
sh 'mvn -B -DskipTests clean package'
}
}
}
}我在下面找到了这个错误,找不到任何解决方案。我使用Windows 10。
docker pull maven:3-alpine
Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon. Is the docker daemon running on this host?). Using system default: https://index.docker.io/v1/
Cannot connect to the Docker daemon. Is the docker daemon running on this host?谢谢大家。
发布于 2017-11-24 16:26:19
您正在使用Docker中的Docker (DinD),这不是推荐的CI方法。您应该将主机的Daemon套接字作为卷挂载到Jenkins容器,如下所示:
docker container run -v /var/run/docker.sock:/var/run/docker.sock ...
因此,您可以在主机上处理图像&容器,而不是在Jenkins容器中。单击此处将了解更多信息。
https://stackoverflow.com/questions/47476032
复制相似问题