If you are running Jenkins on AWS EC2 instance, you can push build docker image on Jenkins and push to ECR registry without creating credentials on Jenkins

You can get a sample Jenkinsfile from my gist.

This pipeline login to ECR and build docker image from Dockerfile in my git repo and pushed to my ECR nginx registry.


Push Docker Image to ECR on Jenkins with EC2 IAM Roles
1.40 GEEK