How do I overcome the docker endpoint error?

I am creating a simple Jenkins pipeline and run into the error below:

Started by user XYZ
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/XYZ1
[Pipeline] {
[Pipeline] isUnix (hide)
[Pipeline] withEnv
[Pipeline] {
[Pipeline] sh
+ docker inspect -f . ubuntu:latest
unable to resolve docker endpoint: open C:/Program Files/Git/certs/client/ca.pem: no such file or directory

My pipeline is as such:

pipeline {
    agent {
        docker { image 'ubuntu:latest' }
   }
   environment {
       dockerImage =''
       registry = 'https://github.com/XYZS/XYZ'
       registryCredential ='d34d387c-0abe-4e39-9260-588e5ad529aa'
   }
  stages {
    stage("Set Up") {
      steps {
        git branch: 'main', url: 'https://github.com/XYZS/XYZ'
      }
    }
    stage("Build docker image") {
      steps {
        script {
            dockerImage = docker.build registry
        }
      }
    }
    stage('Push image') {
     steps {
        script {
            docker.withRegistry('https://registry.hub.docker.com', 'git') {
            app.push("${env.BUILD_NUMBER}")
            app.push("latest")
            }
        }
      }
    }
     stage ('Push to Docker') {
        steps {
            script {
               docker.withRegistry( '', registryCredential ) {
                dockerImage.push()
               }
            }
        }
    }
}}

As of yet I have as advised on other forums to delete and re-install Docker, however, the certs folder in the Git directory does not actually exist.

Has anyone come across this problem and how did you resolve it?

Many thanks in advance,

So I’m a little confused by windows paths and linux paths here. Are you using WSL? I think docker desktop + wsl has its own magic to do things.

That being said, connection to docker is probably managed in one of two places. Wherever jenkins is running, I recommend outputting your env variables (export or printenv in linux) and looking for anything that contains DOCKER_. I think in WSL it’ll be pointed to an https endpoint, with some custom certs. Failing that, that specification should be in your /manage page