Docker Image not uploading to ecr from jenkins

=I created a CI/CD pipline which builds a docker image and pushes to docker image to amazon ecr.

The docker image build perfectly but does not upload to ecr

After building the image it keeps retrying to upload the image to ecr but exits after several trials

pipeline {
    agent any
    environment {
        registryCredential = 'ecr:us-east-1:aws-cred'
        appRegistry = "xxxxxx.dkr.ecr.us-east-1.amazonaws.com/myappimg"
        vprofileRegistry = "https://xxxxxxx.dkr.ecr.us-east-1.amazonaws.com"
        dockerImage = ''
        
    }
    stages{
        stage('Fetch code') {
          steps{
             git branch: 'docker', url: 'https://github.com/xxxxxxxxx/xxxxxxxxxxx.git'
          }  
        }

        stage('Build') {
            steps {
                sh 'mvn clean install -DskipTests'
            }
        }
stage('Build') {
            steps {
                sh 'mvn clean install -DskipTests'
            }
        }
        stage('Test'){
            steps {
                sh 'mvn test'
            }

        }

       
    stage('Build App Image') {
       steps {
       
         script {
                dockerImage = docker.build( appRegistry + ":$BUILD_NUMBER", "./Docker-files/app/multistage/")
             }
stage('Upload App Image') {
          steps{
            script {
              docker.withRegistry( vprofileRegistry, registryCredential ) {
                dockerImage.push("$BUILD_NUMBER")
                dockerImage.push('latest')
              }
            }
          }
     }
         
    }
    
}

Welcome to our community! :smiley:

It's not clear what this has to do with Elasticsearch sorry, can you elaborate please?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.