de59e84d73d3905b6bce2b867dd93f8f8a8b69e3
CI / build (pull_request) Successful in 13s
Add support for the Dockerfile USER directive so that the container's CMD/ENTRYPOINT runs as the configured user instead of root. Changes: - inject.rs: Add user field to Config struct, write /slim/user at build time - build.rs: Pass config.user through to inject() - slim-init.sh: Read /slim/user and drop privileges via su before executing the command. Numeric uids are resolved to usernames via /etc/passwd (BusyBox su does not accept numeric args). When dropping privileges, run as a child (not exec) so PID 1 stays root and can poweroff after the command exits. - test.sh: Add test_user verifying build-time CMD and --cmd override both run as the configured user Closes #7
slim
Turning containers into bootable VMs
Example
# Build the container
podman build ./example/alpine -t slim-alpine
# Make the container bootable. slim injects /slim/init and /slim/exec,
# then packs the rootfs as a qcow2 disk.
slim build qcow2 slim-alpine
# Boot the image using QEMU. The container's CMD runs automatically.
slim run slim-alpine
# Override the command at runtime (base64-encoded on the kernel cmdline):
slim run slim-alpine --cmd '/bin/sh'
# Override the command at build time (baked into /slim/exec):
slim build qcow2 slim-alpine --cmd '/bin/sh'
# Cleanup
slim image rm slim-alpine
podman image rm slim-alpine
Kernel
slim boots VMs using a shared kernel at $XDG_DATA_HOME/slim-rs/registry/vmlinuz.
Place a suitable x86 bzImage there before running slim run.
Languages
Rust
75.1%
Shell
24.7%
Dockerfile
0.2%