0

as a DevOps student I have issue that i couldn't fix

I have this repo https://github.com/lethalfb/insurance

When i run pipeline on my linux machine , everything works great but i would like to run it on my mac m2 laptop and I am getting this error

+ docker build -t lethalfb/insure-me:3.0 --pull --no-cache .
/Users/lethal/.jenkins/workspace/web@2@tmp/durable-fc91d301/script.sh: line 1: docker: command not found

stage part

    
    stage('Docker Image Build'){
        echo 'Creating Docker image'
        sh "docker build -t $dockerHubUser/$containerName:$tag --pull --no-cache ."

I ve Docker Desktop install and tested with hello-world , works fine chmod 777 /var/run/docker.sock applied

Jenkins installed with all necessary plugins also maven, jdk, ansible etc.

Am I missing something here ?

It took long time otherwise i wouldn't disturb nobody

Thanks for help

jenkins errorr jenkins error

Ragnar
  • 1

1 Answers1

0

It could be multiple things; like @Ruslan suggested; it might be an incomplete PATH (of the user running Jenkins / Jenkins Agent).

  • You are allowed to echo the environment variables: sh 'printenv' (Should contain PATH)
  • You are allowed to echo current $PATH directly echo "PATH is: ${env.PATH}"
  • You are allowed to (tmp!) append/adjust the $PATH within the pipeline

Other possibilities:

  • The user running Jenkins / the pipeline has no access to docker, due to docker not being installed for other users (You can get the user running the pipeline/script via: sh 'whoami')
  • Jenkins Agent(s), if used (Alternative to "build-in node(s)"), can be launched as physical machines, virtual machines, Kubernetes clusters, and with Docker images; be extra sure that with the latter two the agent image used "contains" docker
Sir.Chefcoq
  • 330
  • 1
  • 7