使用helm安装了Jenkins
helm install --name jenkins -f values.yaml stable/jenkins已安装Jenkins插件
- kubernetes:1.12.6
- workflow-job:2.31
- workflow-aggregator:2.5
- credentials-binding:1.16
- git:3.9.3
- docker:1.1.6定义了Jenkins管道来构建docker容器
node {
checkout scm
def customImage = docker.build("my-image:${env.BUILD_ID}")
customImage.inside {
sh 'make test'
}
}抛出错误:找不到docker

发布于 2019-04-14 18:54:01
看起来你只安装了插件,而没有安装包。有两种可能性。
- Go to Manage Jenkins
- Global Tools Configuration
- Docker -> Fill name (eg: Docker-latest)
- Check on install automatically and then add installer (Download from [here](https://www.docker.com/)).
- Then save
发布于 2020-06-18 16:03:10
您可以在管道中定义具有所需工具(docker、Maven、Helm等)的容器的agent pod:
首先,使用以下值创建agentpod.yaml:
apiVersion: v1
kind: Pod
metadata:
labels:
some-label: pod
spec:
containers:
- name: maven
image: maven:3.3.9-jdk-8-alpine
command:
- cat
tty: true
volumeMounts:
- name: m2
mountPath: /root/.m2
- name: docker
image: docker:19.03
command:
- cat
tty: true
privileged: true
volumeMounts:
- name: dockersock
mountPath: /var/run/docker.sock
volumes:
- name: dockersock
hostPath:
path: /var/run/docker.sock
- name: m2
hostPath:
path: /root/.m2然后将管道配置为:
pipeline {
agent {
kubernetes {
defaultContainer 'jnlp'
yamlFile 'agentpod.yaml'
}
}
stages {
stage('Build') {
steps {
container('maven') {
sh 'mvn package'
}
}
}
stage('Docker Build') {
steps {
container('docker') {
sh "docker build -t dockerimage ."
}
}
}
}
}https://stackoverflow.com/questions/55674180
复制相似问题