Skip to content

Image list order differs from Docker Engine: older images appear first #364

Closed

Description

@xinde

Kiri version and system

  • Kiri 0.2.1 on macOS 26.5.1, Apple Silicon (arm64)
  • Docker CLI 29.8.2; Kiri reports Engine 27.5.1, API 1.47

What you did

Build two small synthetic images with the same repository and different tags:

tmp_dir=$(mktemp -d)
repo="kiri-order-repro-$(basename "$tmp_dir" | tr "[:upper:]" "[:lower:]" | tr -cd "[:alnum:]")"
printf "FROM scratch\nCOPY marker /marker\n" > "$tmp_dir/Dockerfile"
printf "one\n" > "$tmp_dir/marker"
docker --context kiri build -t "$repo:older" "$tmp_dir"
sleep 2
printf "two\n" > "$tmp_dir/marker"
docker --context kiri build -t "$repo:newer" "$tmp_dir"
docker --context kiri image ls "$repo" --format "{{.Tag}} | {{.CreatedAt}}"
docker --context kiri image inspect "$repo:older" "$repo:newer" --format "{{.Created}}"

# Clean up the synthetic images and build context.
docker --context kiri image rm "$repo:older" "$repo:newer"
rm -rf "$tmp_dir"

What happened

The image list placed the older image before the newer one. In a local test with two synthetic images, the output was:

older | 2026-11-16 15:28:25 +0800 CST
newer | 2026-11-16 15:28:28 +0800 CST

Image inspection confirmed that the newer image was created later. The images were removed after the test.

What you expected instead

The list should match Docker Engine's current behavior, with the most recently created image first. Docker Engine sorts the image list by creation time in both its classic image store and its containerd image store.

In Kiri 0.2.1, the image list handler collects the store's images without an explicit creation-time sort. I have not run this isolated reproducer against a separate Docker Engine or OrbStack instance.

Impact

Scripts that use the first result of docker images -q <repository> may select an older image when used with Kiri. An explicit image tag or the build --iidfile output avoids depending on list order, but matching Docker Engine would reduce compatibility surprises.

Activity

  1. libracoder commented on Nov 16, 2026

    @libracoder
    Owner

    Fixed in #400: docker images now lists the newest image first, as Docker does. It's set for 0.2.2. Checked on macOS, Linux and WSL 2.

  2. libracoder commented on Nov 16, 2026

    @libracoder
    Owner

    Update: the fix is now in #403, which replaces #400.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions