Hi, I am Mubbashir. I specialize in developing highly scalable & distributed web apps. I help startups in developing their apps & ideas. Here I usually write about Microservices, DevOps, AWS and React
So it seems like in version 5 they have removed "Docker: 19" and from now onwards default docker runtime will be available only. To make this code work you can:
Either change the runtime to v4 or less (the article was written at the time when v3 was the latest available).
dev-to-uploads.s3.amazonaws.com/i/...
Hi, I am Mubbashir. I specialize in developing highly scalable & distributed web apps. I help startups in developing their apps & ideas. Here I usually write about Microservices, DevOps, AWS and React
Hi, I am Mubbashir. I specialize in developing highly scalable & distributed web apps. I help startups in developing their apps & ideas. Here I usually write about Microservices, DevOps, AWS and React
The error message is:
An error occurred (AccessDeniedException) when calling the GetAuthorizationToken operation: User: arn:aws:sts:::assumed-role/codebuild-main--build-service-role/AWSCodeBuild--5c2c-4dff-a514- is not authorized to perform: ecr:GetAuthorizationToken on resource: *
[Container] 2021/02/07 14:25:18 Command did not exit successfully $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email) exit status 255
You have probably figured it out already. But for newer folks. You have to replace:
$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
with:
"- aws ecr get-login-password | docker login --username AWS --password-stdin $YOUR-AWS-Repostitory-URI"
Hi, I am Mubbashir. I specialize in developing highly scalable & distributed web apps. I help startups in developing their apps & ideas. Here I usually write about Microservices, DevOps, AWS and React
Great. But I get this error when the code tries to build
YAML_FILE_ERROR Message: Unknown runtime named 'docker'. This build image has the following runtimes: dotnet, golang, java, nodejs, php, python, ruby
So it seems like in version 5 they have removed "Docker: 19" and from now onwards default docker runtime will be available only. To make this code work you can:
Release details: github.com/aws/aws-codebuild-docke...
Oh thanks! Would try this and see how it works.
Sweet. Please do share how it goes!
It worked, but having another issue, the build break when it tries to run this
$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
The error message is:
An error occurred (AccessDeniedException) when calling the GetAuthorizationToken operation: User: arn:aws:sts:::assumed-role/codebuild-main--build-service-role/AWSCodeBuild--5c2c-4dff-a514- is not authorized to perform: ecr:GetAuthorizationToken on resource: *
[Container] 2021/02/07 14:25:18 Command did not exit successfully $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email) exit status 255
You have probably figured it out already. But for newer folks. You have to replace:
$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
with:
"- aws ecr get-login-password | docker login --username AWS --password-stdin $YOUR-AWS-Repostitory-URI"
Example buildspec.yml file:
What have you selected as "Runtime" and "Image"?
I have just setup another pipeline. I made sure I followed your steps exactly as it is. And I still have the same error.
version: 0.2
phases:
install:
runtime-versions:
docker: 19
pre_build:
commands:
- $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
- REPOSITORY_URI=780571656781.dkr.ecr.us-east-2.amazonaws.com/spurts-app
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- docker build -t $REPOSITORY_URI:latest -f Dockerfile .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- printf '[{"name":"spurts-container","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files: imagedefinitions.json
This is my Buildspec file
I removed the entire
install
section. Worked like a charm.