简体   繁体   English

图像未从代码构建发送到 ecr,而构建规范没有错误

[英]Image not sent to ecr from codebuild while buildspec has no error

yaml executed successfully in AWS code build but image not send to aws ecr. yaml 在 AWS 代码构建中成功执行,但图像未发送到 aws ecr。 buildspec.yml file output is given below下面给出 buildspec.yml 文件 output

`[Container] 2020/10/26 09:50:07 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2020/10/26 09:50:07 Phase context status code:  Message: 
[Container] 2020/10/26 09:50:07 Entering phase BUILD
[Container] 2020/10/26 09:50:07 Phase complete: BUILD State: SUCCEEDED
[Container] 2020/10/26 09:50:07 Phase context status code:  Message: 
[Container] 2020/10/26 09:50:07 Entering phase POST_BUILD
[Container] 2020/10/26 09:50:07 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2020/10/26 09:50:07 Phase context status code:  Message: `

Every phase is executed successfully with SUCCEEDED message.每个阶段都成功执行并显示 SUCCEEDED 消息。 Below is the buildspec.yml file code snippet下面是 buildspec.yml 文件代码片段

build:
        commands:
          - echo Build started on `date`
          - echo Building the Docker image...
          - docker build -t $REPOSITORY_URI:latest .
          - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
    post_build:
        commands:
          - echo Build completed on `date`
          - echo Pushing the Docker images...
          - docker push $REPOSITORY_URI:latest
          - docker push $REPOSITORY_URI:$IMAGE_TAG
          - echo Writing image definitions file...
          - printf '[{"name":"ui","imageUri":"%s"}]'    $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
          - cat imagedefinitions.json

No command is being run due to bad indentation.由于缩进错误,未运行任何命令。 Please rectify the indentation using the buildspec reference as guide:请使用 buildspec 参考作为指南纠正缩进:

Also I do not see a docker login before the push:此外,在推送之前我没有看到 docker 登录:

- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com

A buildspce sample for Docker is here: Docker 的 buildspce 示例位于此处:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM