Skip to content

Update ctr image inspect to show erofs filesystem#12772

Draft
dmcgowan wants to merge 3 commits intocontainerd:mainfrom
dmcgowan:erofs-image-convert-inspect
Draft

Update ctr image inspect to show erofs filesystem#12772
dmcgowan wants to merge 3 commits intocontainerd:mainfrom
dmcgowan:erofs-image-convert-inspect

Conversation

@dmcgowan
Copy link
Copy Markdown
Member

@dmcgowan dmcgowan commented Jan 10, 2026

Useful for testing #12555

$ ctr images convert --erofs docker.io/library/alpine:latest docker.io/dmcgowan/alpine:erofs
$ ctr images inspect --content docker.io/dmcgowan/alpine:erofs
docker.io/dmcgowan/alpine:erofs
│    Created: 2026-01-10 00:05:04.255339029 +0000 UTC
│    Updated: 2026-01-10 00:05:04.255339029 +0000 UTC
└── application/vnd.oci.image.index.v1+json @sha256:77521468473c12a4a887ef2e92202066972312678b6dba493351501c1dd4b144 (782 bytes)
...cut...
        │   └───────────────────────
        └── application/vnd.erofs.layer.v1 @sha256:f186752d7d3bbdee3b2e2e8bee0022388f627c48fe22e484f386403c3acce288 (8638464 bytes)
            ┌────────Labels─────────
            │"containerd.io/uncompressed": "sha256:f186752d7d3bbdee3b2e2e8bee0022388f627c48fe22e484f386403c3acce288"
            │"containerd.io/distribution.source.docker.io": "library/alpine"
            └───────────────────────
            ┌──────EROFS Layer──────
            │ /
            │ ├─ bin/
            │ │    arch ash base64 bbconfig busybox cat chattr chgrp chmod chown cp date dd df dmesg dnsdomainname dumpkmap echo egrep false fatattr fdflush fgrep
            │ │    fsync getopt grep gunzip gzip hostname ionice iostat ipcalc kbd_mode kill link linux32 linux64 ln login ls lsattr lzop makemime mkdir mknod
            │ │    mktemp more mount mountpoint mpstat mv netstat nice pidof ping ping6 pipe_progress printenv ps pwd reformime rev rm rmdir run-parts sed setpriv
            │ │    setserial sh sleep stat stty su sync tar touch true umount uname usleep watch zcat
            │ ├─ dev/
            │ ├─ etc/
...cut...

Uncut output https://gist.github.com/dmcgowan/4017ca98baa9fdc2c7177f961769fbd9

ChengyuZhu6 and others added 2 commits January 9, 2026 16:10
Add EROFS conversion support to ctr convert command with configurable
options for tar-index mode and mkfs parameters.

Usage:
  ctr image convert --erofs src:tag dst:tag
  ctr image convert --erofs --erofs-compression='lz4hc,12' src:tag dst:tag

Signed-off-by: ChengyuZhu6 <[email protected]>
Signed-off-by: Derek McGowan <[email protected]>
@dmcgowan dmcgowan force-pushed the erofs-image-convert-inspect branch from 6c9acd4 to 56c6105 Compare January 10, 2026 08:55
} else if strings.HasPrefix(desc.MediaType, images.MediaTypeErofsLayer) {
fmt.Fprintf(p.w, "%s┌──────EROFS Layer──────\n", prefix)

f, err := store.ReaderAt(ctx, desc)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing f.Close() for the ReaderAt — will leak FDs.


// but if root itself is a symbolic link, its target will be walked.
// func WalkDir(fsys FS, root string, fn WalkDirFunc) error {
func PrintDirectory(f io.Writer, fsys fs.FS, dir string, prefix string) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For layers with many files, verbose output could get pretty long. Maybe worth adding a depth limit or file count cap?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was thinking that as well or summing up the size even. Just wanted to start out simple to see if this is something useful. I know it's helpful for me but I also just want a sanity check and more rarely would want to check a specific file. In that specific file case, probably want size and perms too

@hsiangkao
Copy link
Copy Markdown
Member

Thanks for this 👍👍 I have to prioritize go-erofs now 😅

@k8s-ci-robot
Copy link
Copy Markdown

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@anniecherk anniecherk mentioned this pull request Feb 4, 2026
@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open 90 days with no activity. This PR will be closed in 7 days unless new comments are made or the stale label is removed.

@github-actions github-actions Bot added the Stale label Apr 15, 2026
@hsiangkao
Copy link
Copy Markdown
Member

maybe rebase it as well... it should be a simple change after go-erofs is landed..

@github-actions github-actions Bot removed the Stale label Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

4 participants