I\'m not able to push ocker images to Amazon ECR with Jenkins Pipeline: I always get no basic auth credentials
:-(
Here is my setup:
just remove or rename $HOME/.docker/config.json file from your local pc or cloud server. It will solve the no basic auth credentials issue.
Follow the below step in your terminal:
mv $HOME/.docker/config.json $HOME/.docker/config.json.backup
Even that it seems logical that docker.withRegistry will perform a login to ECR at start and logout when done, it is not performed. Therefor you must install awscli and add ECR login command before you perform the push.
sh("eval \$(aws ecr get-login --no-include-email | sed 's|https://||')")
See http://www.tikalk.com/devops/ecr-in-pipeline/ for detailed example.