pipeline { environment { registry = 'https://registry.hub.docker.com' registryCredential = 'dockerhub_jcabillot' dockerImage = 'jcabillot/jenkins-wdocker' } 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://registry.hub.docker.com', credentialsId: 'dockerhub_jcabillot') { sh 'docker push jcabillot/jenkins-wdocker' } } } } } }