Summary
Volume mounts only accept directories — a single-file host path is rejected. Sharing one config file into a box therefore isn't expressible; callers must instead share the parent directory, or (as we do) inline the file's contents into the box command with a heredoc.
Where (as of 07fa30f9)
resolve_user_volumes rejects any non-directory host path:
// src/boxlite/src/litebox/init/types.rs:66
if !resolved_path.is_dir() {
return Err(BoxliteError::Config(format!(
"Volume host path is not a directory: {}",
vol.host_path
)));
}
This is consistent with the virtio-fs share model (a share is a directory tree), so the constraint is understandable — but Docker/containerd support single-file bind mounts by sharing the parent and bind-mounting the file at the target inside the guest.
Repro
opts = BoxOptions(..., volumes=[("/host/path/config.yaml", "/etc/app/config.yaml", False)])
# -> BoxliteError::Config: "Volume host path is not a directory: /host/path/config.yaml"
Expected
Support a single-file volume mount — e.g. share the file's parent directory as a virtio-fs tag and bind-mount just that file to guest_path inside the guest, leaving the rest of the parent dir invisible.
Current workaround (downstream)
apps/infra-local inlines each config file into the box command via a shell heredoc instead of mounting it. This affects three services today (dex, caddy, minio-init) — see apps/infra-local/boxlite_local/services.py (_DEX_ENTRYPOINT, _caddyfile/_CADDY_ENTRYPOINT_TEMPLATE, _MINIO_INIT_SCRIPT). Each is a brittle cat > … <<'__CFG__' block that a single-file mount would replace.
Summary
Volume mounts only accept directories — a single-file host path is rejected. Sharing one config file into a box therefore isn't expressible; callers must instead share the parent directory, or (as we do) inline the file's contents into the box command with a heredoc.
Where (as of
07fa30f9)resolve_user_volumesrejects any non-directory host path:This is consistent with the virtio-fs share model (a share is a directory tree), so the constraint is understandable — but Docker/containerd support single-file bind mounts by sharing the parent and bind-mounting the file at the target inside the guest.
Repro
Expected
Support a single-file volume mount — e.g. share the file's parent directory as a virtio-fs tag and bind-mount just that file to
guest_pathinside the guest, leaving the rest of the parent dir invisible.Current workaround (downstream)
apps/infra-localinlines each config file into the box command via a shell heredoc instead of mounting it. This affects three services today (dex, caddy, minio-init) — seeapps/infra-local/boxlite_local/services.py(_DEX_ENTRYPOINT,_caddyfile/_CADDY_ENTRYPOINT_TEMPLATE,_MINIO_INIT_SCRIPT). Each is a brittlecat > … <<'__CFG__'block that a single-file mount would replace.