Add -i/--inspect to display an image's declared config
Prints user/group, exposed ports, env, volumes, and default command from OciImageConfig without mounting or running the image. Extend inspect_image_command() whenever OciImageConfig gains a new field. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Gv3s5jckJKzh6JkMoi2Akz
This commit is contained in:
@@ -57,6 +57,7 @@ slocker-lite -r|--run <image.tar> [-- <command> [args...]]
|
||||
slocker-lite -u|--umount <layer-id>
|
||||
slocker-lite -c|--cleanup <layer-id>
|
||||
slocker-lite -l|--list-images <directory>
|
||||
slocker-lite -i|--inspect <image.tar>
|
||||
slocker-lite -v|--volume <name> <directory>
|
||||
slocker-lite --list-volumes
|
||||
slocker-lite --delete-volume <name>
|
||||
@@ -76,6 +77,7 @@ slocker-lite -V|--version
|
||||
| `--user <user>` | With `--run`, run the command as this user (name or numeric uid) instead of the image's own declared user (or root, if it declares none). Resolved against the image's own `/etc/passwd`. Only takes effect when `--run` executes as root. |
|
||||
| `--group <group>` | With `--user`, use this group (name or numeric gid) instead of the user's primary group. |
|
||||
| `-l, --list-images <dir>` | List OCI Image Layout tars (`*.tar`, `*.tar.*`) found directly in `<dir>`, with their `name:tag`. |
|
||||
| `-i, --inspect <image.tar>` | Print an image's declared user, exposed ports, env, volumes, and default command, without mounting or running it. |
|
||||
| `-v, --volume <name> <dir>` | Create a named volume mapped to a host directory (created if missing), recorded in the config file's `volumes` section. Fails if the name or directory is already used by an existing volume. |
|
||||
| `--list-volumes` | List all named volumes (see `-v/--volume`) with their host directory. |
|
||||
| `--delete-volume <name>` | Remove a named volume from the config. The host directory is left untouched. |
|
||||
@@ -103,6 +105,9 @@ sudo ./buildDir/slocker-lite -r myimage.tar --user git
|
||||
# List every OCI image tar in a directory
|
||||
./buildDir/slocker-lite -l ./images
|
||||
|
||||
# Inspect an image's declared config without mounting or running it
|
||||
./buildDir/slocker-lite -i myimage.tar
|
||||
|
||||
# Create a named volume backed by a host directory
|
||||
./buildDir/slocker-lite -v mydata ~/slocker-volumes/mydata
|
||||
|
||||
|
||||
Reference in New Issue
Block a user