I am running jenkins on a aws server Working on a pipeline for building docker images and push to ECR on the same aws account
def aws_account = "https://xxxxxx.ecr.us-west-2.amazonaws.com/"
def ecr_credentials = "iam-role-arn for ecr"
docker.withRegistry(aws_account + "${ecr_repository_name}", "ecr:us-west-2:${ecr_credentials}") {
docker.image(customImage).push()
}
While pushing I am getting below error tcp:lookup is pointing to the account number itself
Error: docker.service Mar 04 10:46:13 ip-x-xxx-x-xxx dockerd[921]: time="2021-03-04T10:46:13.989576275Z" level=error msg="Handler for POST /v1.41/auth returned error: Get https://yyyyyyy.ecr.us-west-2.amazonaws.com/v2/: dial tcp: lookup yyyyyyy.ecr.us-west-2.amazonaws.com: no such host"