# Docker Image not uploading to ecr from jenkins

**URL:** <https://discuss.elastic.co/t/docker-image-not-uploading-to-ecr-from-jenkins/316616>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [October 14, 2022, 9:24am UTC](https://discuss.elastic.co/t/docker-image-not-uploading-to-ecr-from-jenkins/316616 "2022-10-14T09:24:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![veera\_ravala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/veera_ravala/32/112060_2.png) [@veera\_ravala](https://discuss.elastic.co/u/veera_ravala)\
**Post date:** [October 14, 2022, 9:24am UTC](https://discuss.elastic.co/t/docker-image-not-uploading-to-ecr-from-jenkins/316616/1 "2022-10-14T09:24:52Z")

</div>

=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

```auto
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'
            }
        }

```

```auto
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/")
             }

```

```auto
stage('Upload App Image') {
          steps{
            script {
              docker.withRegistry( vprofileRegistry, registryCredential ) {
                dockerImage.push("$BUILD_NUMBER")
                dockerImage.push('latest')
              }
            }
          }
     }
         
    }
    
}

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/c/4c9e80774a7479876514e7313ceae68fe3636bef.png)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 17, 2022, 11:54pm UTC](https://discuss.elastic.co/t/docker-image-not-uploading-to-ecr-from-jenkins/316616/2 "2022-10-17T23:54:40Z")

</div>

Welcome to our community! 😃

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 14, 2022, 11:55pm UTC](https://discuss.elastic.co/t/docker-image-not-uploading-to-ecr-from-jenkins/316616/3 "2022-11-14T23:55:32Z")

</div>

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