pitchblack408
pitchblack408

Reputation: 2983

How to specify AWS ECR Image URI using Kaniko to push image?

Kaniko is a common tool that is used for creating docker images while inside Kubernetes clusters. In my case I am using Kaniko to publish images to AWS ECR. I don't have any issues publishing the images to ECR, but there is an issue with the value which is set in the Amazon ECR Repository within the viewing details. I don't see the expected value for the "Image URI". I thought that the Image URI would be set by the order of pushing which Kaniko does; But that isn't the case, the order seems random.

Here is an example of my push:

DEST1="${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/${REPOSITORY}/demo:eva_test_ub20"
DEST2="${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/${REPOSITORY}/demo:test_ub20"
DEST3="${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/${REPOSITORY}/demo:169109213"
/kaniko/executor --context $CI_PROJECT_DIR \
  --context "${CI_PROJECT_DIR}" \
  --dockerfile "${CI_PROJECT_DIR}/Dockerfile" \
  --destination "${DEST1}" \
  --destination "${DEST2}" \
  --destination "${DEST3}"

I can't seem to get set AWS ECR Image URI to a specific value that I want it to pick. Is there anyway to do this using Kaniko?

Form a different example

enter image description here I had to cut out the region, image name, and account number.

From AWS Support:

When images are pushed, ECR will use the last pushed tag in the URI. Similar to when pushing a docker image1. So if you would like demo:169109213 to be used in the URI then that should be the last image pushed.

I did some verification on what AWS support stated, but found that it still wasn't working as expected. While using the Kaniko command, I found that no matter which order I placed the destination flags in, the wrong url is displayed in AWS ECR UI.

Is it possible that Kaniko is pushing the images in a different order than Kaniko shows in it's terminal output?

Upvotes: 0

Views: 1764

Answers (1)

pitchblack408
pitchblack408

Reputation: 2983

From AWS Support:

Currently, it's not be possible to customize/configure the image URI in such a way that a specific tag will be appended to it.

Upvotes: 0

Related Questions