optiopay / klar

Integration of Clair and Docker Registry
MIT License
506 stars 138 forks source link

How does ECR integration work? #13

Closed jaekunchoi closed 7 years ago

jaekunchoi commented 7 years ago

It seems there is no explanation on usage with ECR.

With AWS ECR you typically use IAM Roles with EC2 instance so all we need is aws ecr get-login

There is no need to pass in DOCKER_USER and DOCKER_PASSWORD and I'm getting

Can't pull image: Can't parse Www-Authenticate: Basic realm="https://1234567890.dkr.ecr.ap-southeast-2.amazonaws.com/",service="ecr.amazonaws.com"

Any work around here?

hashmap commented 7 years ago

Klar doesn't use docker at all, docker login doesn't affect Klar. So far you need to manually generate user name (usually AWS) and password (-p value) using aws ecr get-login and pass it to Klar as DOCKER_USER and DOCKER_PASSWORD. Seamless integration with ECR could be implemented later on.

hashmap commented 7 years ago

I've added some info README file, I hope it solves your issue. Also please update to the latest version 1.2.1, the previous versions contain a minor bug which is critical for ECR integration.

karthikeayan commented 5 years ago

sh "DOCKER_USER=AWS DOCKER_PASSWORD=$PASSWORD CLAIR_ADDR=$CLAIR_URL CLAIR_OUTPUT=Critical klar $ECR_REPOSITORY_URI"

faced same issue when running klar with jenkins, converting single line command into multiline, made it worked.

sh """
    export DOCKER_USER=AWS
    export DOCKER_PASSWORD=$PASSWORD
    export CLAIR_ADDR=$CLAIR_URL
    export CLAIR_OUTPUT=Critical
    klar $ECR_REPOSITORY_URI
"""