Ваш агент, выполняющий конвейер, не связывается с демоном docker, поэтому вам нужно правильно его настроить, и у вас есть три способа (известных мне):
1) Предоставить вашему агенту установку Docker
2) Добавить установку Docker из https:/$JENKINS_URL/configureTools/
3) Если вы используете Kubernetes в качестве оркестратора, вы можете добавить определение podTemplate в начале вашего конвейера, а затем использовать его, вот пример:
// Name of the application (do not use spaces)
def appName = "my-app"
// Start of podTemplate
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(
label: label,
containers: [
containerTemplate(
name: 'docker',
image: 'docker',
command: 'cat',
ttyEnabled: true)],
volumes: [
hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock'),
hostPathVolume(hostPath: '/usr/bin/kubectl', mountPath: '/usr/bin/kubectl'),
secretVolume(mountPath: '/etc/kubernetes', secretName: 'cluster-admin')],
annotations: [
podAnnotation(key: "development", value: appName)]
)
// End of podTemplate
[...inside your pipeline]
container('docker') {
stage('Docker Image and Push') {
docker.withRegistry('https://registry.domain.it', 'nexus') {
def img = docker.build(appName, '.')
img.push('latest')
}
Надеюсь, это поможет вам