Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions crates/sandlock-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ struct RunArgs {
#[arg(short = 'i', long)]
interactive: bool,

/// Use a local Docker image as chroot rootfs
#[arg(long)]
/// Use a local Docker image as chroot rootfs, given by reference
/// (e.g. `python:3.12-slim`, a digest, or an image id). The image
/// must already be present in local Docker storage; sandlock never
/// pulls from a registry. Requires a running Docker daemon and an
/// accessible socket; the run fails early if neither is reachable.
#[arg(long, value_name = "IMAGE")]
image: Option<String>,

/// Dry-run: run the command, show filesystem changes, then discard
Expand Down Expand Up @@ -429,13 +433,13 @@ async fn run_command(args: RunArgs) -> Result<i32> {
// the shared image cache directly.
let image_cmd: Option<Vec<String>>;
if let Some(ref img) = args.image {
let rootfs = sandlock_core::image::extract(img, None)?;
let rootfs = sandlock_core::image::extract(img, None).await?;
builder = builder.chroot(&rootfs).fs_read("/");
if pb.workdir.is_none() {
builder = builder.workdir(&rootfs);
}
if args.cmd.is_empty() {
image_cmd = Some(sandlock_core::image::inspect_cmd(img)?);
image_cmd = Some(sandlock_core::image::inspect_cmd(img).await?);
} else {
image_cmd = None;
}
Expand Down
5 changes: 4 additions & 1 deletion crates/sandlock-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "Lightweight process sandbox using Landlock, seccomp-bpf, and secc
libc = "0.2"
syscalls = { version = "0.8", default-features = false }
nix = { version = "0.29", features = ["process", "signal", "fs", "ioctl", "poll"] }
tokio = { version = "1", features = ["rt", "net", "time", "sync", "macros", "io-util"] }
tokio = { version = "1", features = ["rt", "net", "time", "sync", "macros", "io-util", "fs"] }
serde = { version = "1", features = ["derive"] }
thiserror = "2"
rand = "0.8"
Expand All @@ -26,7 +26,10 @@ toml = "0.8"
jiff = "0.2"
pathdiff = "0.2"
hudsucker = "0.22"
tar = "0.4"
clap = { version = "4", features = ["derive"], optional = true }
bollard = "0.21"
futures-util = "0.3"

[features]
default = []
Expand Down
Loading
Loading