Skip to content

Engine: images list newest first, and a missing working directory is made for non-root and read-only containers - #403

Merged
libracoder merged 1 commit into
mainfrom
engine-api-batch1-v2
Nov 16, 2026
Merged

libracoder merged 1 commit into
mainfrom
engine-api-batch1-v2

Conversation

@libracoder

@libracoder libracoder commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two small Docker compatibility fixes in the engine:

Motivation

Changes

  • crates/kiri/src/daemon/api.rs: images() sorts by Created, newest first.
  • crates/kiri-init/src/linux/container.rs: a new make_workdir() runs right after pivot_root, while the process is still root and before the read-only remount. It creates a missing working directory with mode 0755, owned by root, as Docker leaves it. The existing fallback after the user switch stays for exec.
  • tests/e2e.sh: adds images-newest-first, workdir-created-nonroot, workdir-created-nonroot-mode, workdir-created-readonly and workdir-created-readonly-nonroot.

Behaviour changes

  • docker images and GET /images/json return images newest first. The window sorts its own list, so it looks the same.
  • docker run -u 1000:1000 -w /missing/dir … now starts, inside /missing/dir, which is owned by root with mode 0755. Before, it exited 127.
  • docker run --read-only -w /missing/dir … (root or not) now starts too. The root is still read-only: writing anywhere else in it fails as before.

Testing

Replaces #400, adding the --read-only case.

Both fixes were checked against main on all three systems, together with the open PRs for the same release (#392, #393, #372):

  • Linux (engine in a Linux container, kernel 6.18): on main, images come oldest first and the non-root run exits 127. On this branch, images come newest first, and the non-root and --read-only runs start in a 755 root directory, while --read-only still refuses writes to the root. Full tests/e2e.sh: no test fails on this branch that passes on main.
  • Windows / WSL 2 (tests/wsl.sh x86_64 on the WSL 2 kernel): 21/21 pass on both main and the branch. The same checks, including the read-only ones, give the same results as on Linux.
  • macOS (Apple silicon, Kiri's VM): the same checks give the same results.
  • Unit tests: cargo test -p kiri passes. cargo clippy shows no new warnings on the host or the Linux target.

Checklist

  • Works on macOS, Linux and Windows (WSL 2)
  • Tests added (tests/e2e.sh)
  • No new warnings

@libracoder libracoder added the bug Something isn't working label Nov 16, 2026
@libracoder libracoder self-assigned this Nov 16, 2026
@libracoder libracoder added this to the 0.2.2 milestone Nov 16, 2026
@libracoder
libracoder merged commit 473ee22 into main Nov 16, 2026
7 checks passed
@libracoder
libracoder deleted the engine-api-batch1-v2 branch November 16, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

1 participant