I use Jenkins to checkout source code and build image and push the image.
In Jenkins I configurate Docker just like this:
in my Jenkins Pipeline Script
pipeline { agent none environment { registry = "" registryCredential = '' imageName = 'imageName' dockerImage = '' dockerHome = tool 'docker_latest' PATH = "$dockerHome/bin:$PATH" }
stages {
stage('Prepare') {
agent {
label "${config.job.agent}"
}
steps {
echo "CheckOut"
script {
checkout
}
}
}
stage('Building image') {
steps{
dir('jenkins-slave-savi'){
script {
dockerImage = docker.build imageName + ":$BUILD_NUMBER"
}
}
}
}
stage('Deploy Image'){
steps {
script {
docker.withRegistry(registry) {
dockerImage.push()
}
}
}
}
}
}
but when I run this script, I got this error:
ERROR: Failed to download pre-1.11.x URL https://get.docker.com/builds/Linux/x86_64/docker-latest from agent: java.net.ConnectException: Connection timed out (Connection timed out)
ERROR: Failed to download https://get.docker.com/builds/Linux/x86_64/docker-latest.tgz from agent; will retry from master
any solutions???
