aws-samples / amazon-ecr-replication-for-pub-container-images

Amazon ECR replication for public container images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

部署到日本区报如下错误

steveliu-cn opened this issue · comments

image

环境:MAC
npm version:7.24.0
node.js version: v16.10.0

image
不知道为啥咋建立code commit repo的时候 报zip 包不合法

@steveliu-cn I know this is an old issue but I found the solution and pasting for everyone who needs a solution.

  1. I deleted the zip file on the S3 bucket

Screen Shot 2022-02-22 at 6 27 30 PM

  1. Zipped the current assets on my local repo

cd cdk.out && zip -R 17008a04c1e0a75efe1711fa9b759f4042aa4bb00842e31af67bdcd3a1c38e9b.zip asset.17008a04c1e0a75efe1711fa9b759f4042aa4bb00842e31af67bdcd3a1c38e9b/*

  1. Upload the new assets file 17008a04c1e0a75efe1711fa9b759f4042aa4bb00842e31af67bdcd3a1c38e9b.zip on the S3 bucket replacing the deleted file.

  2. Rerun npx cdk deploy --parameters... again. The error is gone and able to finish the script.

 2/10 | 6:24:37 PM | CREATE_IN_PROGRESS   | AWS::CodeCommit::Repository | cfnCodeRepo Resource creation Initiated
 3/10 | 6:24:37 PM | CREATE_COMPLETE      | AWS::CodeCommit::Repository | cfnCodeRepo 

Screen Shot 2022-02-22 at 6 33 03 PM

not sure if anyone is still looking at this, but I faced the same issue and it only worked for me after following the steps above and making the zip file public. Not sure why exactly, but that is what I did.

same problem

楼上的同学应该像是网络问题,请重试一下。我把CDK的版本都升级到了最新的v2,可以重新pull一下升级尝试一下,我在本地都是可以部署成功的。

我偷懒换解决方案了。

我遇到的问题:Codebuild 卡死(可能是网络原因)

Dockerfile 里的第一行:

FROM node:18.14.2-alpine3.17

因为是从 Docker Hub 获取内容,在 cn-north-1(北京区) 的 Codebuild 会卡死,试了两三次都是一样。

解决方法

自己 pull 下来然后自己 push 到 ECR 里。

# 如果你用的是 MacBook Pro M1 Pro 芯片(或者其他 M 系列芯片),这里一定要写 platform。
# 因为你拿到的镜像 platform 和 AWS Codebuild 的 Ubuntu 镜像是不同的。
docker pull --platform linux/amd64 node:18.14.2-alpine3.17 

docker tag node:18.14.2-alpine3.17 832343096630.dkr.ecr.cn-north-1.amazonaws.com.cn/node:18.14.2-alpine3.17

docker push 832343096630.dkr.ecr.cn-north-1.amazonaws.com.cn/node:18.14.2-alpine3.17

原因

我看不懂 CDK 是啥,我现在也没心情去学 AWS 里各种乱七八糟的服务。

最后,替换一下 Dockerfile 的 FROM:

FROM 832343096630.dkr.ecr.cn-north-1.amazonaws.com.cn/node:18.14.2-alpine3.17