https://pulumi.com logo
Title
m

millions-furniture-75402

01/06/2023, 2:10 PM
Okay... I was able to get it a little futher, but it's appending a
v2
to the server...
const lambdaImage = new docker.Image(`${appName}-image`, {
  build: { ... },
  registry: {
    server: "<http://localhost:4566/>",
    username: "test",
    password: "test",
  },
  imageName: `${appName}-image`,
});
docker:image:Image (test-app-image):
    error: Error response from daemon: login attempt to <http://localhost:4566/v2/> failed with status: 404 Not Found

    error: Error: ' docker login' failed with exit code 1
Solved it with:
aws.sdk.config.credentials = {
  accessKeyId: "test",
  secretAccessKey: "test",
};
aws.sdk.config.region = aws.config.region;
and
imageName: `localhost:4510/${appName}-image`,
There is also a race condition with the first request to ECR and the
docker login
. On the creation of a new repository, ECR in localstack starts the http server. When using awsx to create the repository, this also impies
docker login
.
docker login
is happening before the http server is ready and causes the failure above. To work around, I use the aws cli to create a fake repository, to get the ECR http server running before
docker login
.