Closed Rowern closed 5 years ago
@Rowern we don't use aws registry in production but I guess you might need to set a few environment variables: https://github.com/awslabs/amazon-ecr-credential-helper#prerequisites
Manually calling the /makisu-internal/docker-credential-ecr-login
does work.
(using the command: echo '525034297126.dkr.ecr.eu-west-3.amazonaws.com' | /makisu-internal/docker-credential-ecr-login get
, I do get the output {"ServerURL":"525034297126.dkr.ecr.eu-west-3.amazonaws.com","Username":"AWS","Secret":"ey.."}
).
What is weird is that when runned inside makisu, it does get a x509: certificate signed by unknown authority
.
I tried installing ca-certificates inside the alpine, moving ca certs in the internal dir cp /etc/ssl/certs/ca-certificates.crt /makisu-internal/certs/ca-certs.pem
or even specifying the CA file cp /etc/ssl/certs/ca-certificates.crt /makisu-internal/certs/ca-certs.pem
in the config.yaml.
Nothing seems to work...
As I'm able to generate valid credentials manually calling the docker-credential-ecr-login
, how can I tweak the config.yaml to use them ?
I tried soemthing like this but it did not work:
"525034297126.dkr.ecr.eu-west-3.amazonaws.com":
".*":
push_chunk: -1
security:
tls:
client:
disabled: false
basic:
username: AWS
password: |-
<base64 decoded value from the above `docker-credential-ecr-login get`["Secret"] output>
Some more debug infos:
ca-certificates
package inside the alpine image{"level":"error","ts":1555402933.345393,"msg":"Failed to push cache: push layer sha256:bdf0201b3a056acc4d6062cc88cd8a4ad5979983bfb640f15a145e09ed985f92: check layer exists: 525034297126.dkr.ecr.eu-west-3.amazonaws.com/api-gateway (sha256:bdf0201b3a056acc4d6062cc88cd8a4ad5979983bfb640f15a145e09ed985f92): check manifest exists: HEAD https://525034297126.dkr.ecr.eu-west-3.amazonaws.com/v2/api-gateway/blobs/sha256:bdf0201b3a056acc4d6062cc88cd8a4ad5979983bfb640f15a145e09ed985f92 401"}
Weirdly enough, I do get an ouput when using curl (using credential from the docker ecr helper) inside the same docker:
$ curl -u AWS:ey... --head https://525034297126.dkr.ecr.eu-west-3.amazonaws.com/v2/api-gateway/blobs/sha256:bdf0201b3a056acc4d6062cc88cd8a4ad5979983bfb640f15a145e09ed985f92
HTTP/1.1 200 OK
...
So I think it might come from here: https://github.com/uber/makisu/blob/43f600617ec80b1984fbb0b7841fde8c0aa49ee6/lib/registry/client.go#L426-L450
I'm also receiving this error. Is there any reason why ca-certificates
shouldn't be installed inside the image?
Remember this happens in the build environment, which means packages will be installed only when it is stated in your Dockerfile. By default makisu does not install it, but it has a list of default certificates under /makisu-internal.
When I was testing the gcr credhelper I found that I needed to specify a few additional environment variables (for example, SSL_CERT_DIR) due to the assumptions in the gcr credhelper. Maybe this helps a little bit: https://github.com/uber/makisu/pull/125
Doing a simple apk add -U ca-certificates
fixes the issue with certificate. But then the next error is the 401.
Investigating further I found a fix (see https://github.com/uber/makisu/pull/208) that does fix the issue of authenticating to the AWS ECR.
Should be fixed now that the PR is merged!
Thanks for the fix!
Using the docker image: gcr.io/makisu-project/makisu-alpine:v0.1.9 With the folllowing configuration:
I get certificate validation errors:
It seems like the ecr credentials helper cannot find the cacert to validate the aws certificate.
Did I miss something ?