I’m encountering an issue on my MacBook M1 Pro while using Jenkins. The problem is related to Docker not being found, despite having installed the Jenkins Docker plugin. Here are the details of my setup:
MacBook Model: M1 Pro
Jenkins Configuration: i download it with brew
Docker Plugin: Installed
Jenkins Pipeline:
`pipeline {
agent any
environment {
DOCKERHUB_CREDENTIALS = credentials('dh_cred')
}
triggers {
pollSCM('*/5 * * * *') // VĂ©rifier toutes les 5 minutes
}
stages {
stage('Checkout'){
agent any
steps{
checkout scm
}
}
stage('Init'){
steps{
// Permet l'authentification
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('Build'){
steps {
sh 'docker build -t $DOCKERHUB_CREDENTIALS_USR/express-sqlite-app:$BUILD_ID .'
}
}
stage('Deliver'){
steps {
sh 'docker push $DOCKERHUB_CREDENTIALS_USR/express-sqlite-app:$BUILD_ID'
}
}
stage('Cleanup'){
steps {
sh 'docker rmi $DOCKERHUB_CREDENTIALS_USR/express-sqlite-app:$BUILD_ID'
sh 'docker logout'
}
}
}
}`
I’ve already installed the Docker plugin for Jenkins, but the system seems unable to locate Docker. I would appreciate any guidance on resolving this issue. Are there any specific configurations or steps I might be missing for Docker on M1 Pro?
Thank you for your help!
2
Answers
You need to install Docker desktop on your machine, which includes the Docker engine which is needed to run containers. Installing a plugin with Jenkins is not enough. Refer to the installation steps. Once you have finished installing it, your pipeline should be able to run Docker commands.
On a separate note, you do not need any Docker plugins to run docker on Jenkins unless you are trying to use Docker containers as Jenkins agents.
You need to install Docker desktop on your machine, which includes the Docker engine which is needed to run containers. Installing a plugin with Jenkins is not enough. Refer to the https://docs.docker.com/desktop/install/mac-install/. Once the installation is completed, your pipeline should be able to run Docker commands.