- Newest
- Most votes
- Most comments
To authenticate and push Docker images to Amazon ECR through a vanity domain, you need to ensure that the authentication token has the proper permissions for both pull and push operations.
Based on your description, the issue appears to be related to how the authorization token is being handled during push operations. When you use aws ecr get-login-password and pipe it to Docker login, you're obtaining an authorization token that's valid for 12 hours. This token's permission scope matches that of the IAM principal used to retrieve it.
For your vanity domain setup with a Lambda proxy, there are a few potential issues to check:
-
The Lambda function might not be correctly passing the authorization headers or tokens during push operations, which involve different API calls than pull operations.
-
The IAM permissions of the user/role generating the token might have pull permissions but not push permissions to the repository.
-
The S3 bucket error you're seeing ("403 Forbidden" from the starport-layer-bucket) suggests that the proxy might not be correctly handling the multi-part upload process that occurs during image pushes.
When pushing an image to ECR, Docker communicates with multiple AWS services, including S3 for layer storage. Your proxy needs to handle all these communications correctly, including proper authentication for each service.
To troubleshoot:
-
Verify that the IAM user/role has both push and pull permissions for the ECR repository.
-
Check that your Lambda proxy correctly passes all headers and authentication tokens for both the ECR API and the S3 API calls.
-
Consider implementing detailed logging in your Lambda function to see exactly what requests are being made during push operations and how they differ from pull operations.
-
Test pushing directly to the AWS ECR endpoint to confirm that permissions are correctly configured.
The error specifically mentions the S3 starport-layer-bucket, which is part of ECR's backend storage. This suggests that while your authentication works for the ECR API itself, the proxy might not be correctly handling the subsequent S3 operations required for pushing image layers.
Sources
Private registry authentication in Amazon ECR - Amazon ECR
Pushing a multi-architecture image to an Amazon ECR private repository - Amazon ECR
Expanding container security and choice with Amazon ECR Public | Containers
Community | Run a java service serverless with ECS and Fargate
Moving an image through its lifecycle in Amazon ECR - Amazon ECR
answered 9 months ago
Relevant content
asked a year ago
asked 3 years ago
- AWS OFFICIALUpdated 3 years ago
