0

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?

pitchblack408
  • 2,913
  • 4
  • 36
  • 54
  • can you share what you are seeing and what you expect to see to make it more clear. Also, as per the script the same image is pushed with just different tags, in which case i dont think the order in which the tags are displayed in ECR matter. you can fetch with a URI with any of the tags specified. – kumar harshit Aug 04 '23 at 02:49
  • Yeah, I will take a screenshot and blur stuff out when I get the time. – pitchblack408 Aug 04 '23 at 16:20
  • @kumarharshit, I added an image – pitchblack408 Aug 07 '23 at 16:41

1 Answers1

0

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.

pitchblack408
  • 2,913
  • 4
  • 36
  • 54