pipeline { environment { registry = 'https://registry.hub.docker.com' registryCredential = 'dockerhub_jcabillot' dockerImage = 'jcabillot/jenkins-wdocker' } agent any stages { stage('Clone repository') { steps{ checkout scm } } stage('Build image') { steps{ sh "docker build -t jcabillot/jenkins-wdocker ." } } stage('Deploy Image') { steps{ script { withDockerRegistry(url: 'https://docker.io', credentialsId: 'dockerhub_jcabillot') { sh 'cat /var/jenkins_home/workspace/perso_jenkins-wdocker_master@tmp/abed23b6-7300-4b49-82d2-0f788b5079a0/config.json' sh 'docker push jcabillot/jenkins-wdocker' } } } } } }