docker-command

Crates.iodocker-command
lib.rsdocker-command
version5.0.1
sourcesrc
created_at2020-09-05 22:01:21.438192
updated_at2024-03-20 21:35:28.456098
descriptionLibrary for creating Docker commands
homepage
repositoryhttps://github.com/nicholasbishop/docker-command
max_upload_size
id285234
size37,887
Nicholas Bishop (nicholasbishop)

documentation

README

docker-command

This tool is no longer under active development. If you are interested in taking over or repurposing the name on crates.io, feel free to contact me: nbishop@nbishop.net

crates.io Documentation

Rust library for creating Docker commands.

Rather than speaking directly to the Docker daemon, this library produces commands that can be run in a subprocess to invoke the Docker client (or a compatible client such as Podman).

This crate depends on the command-run crate. That crate's logging feature (which controls whether the log crate is a dependency) can be toggled with this crate's logging feature (enabled by default).

Example

let output = Launcher::auto()
    .ok_or("container comand not found")?
    .run(RunOpt {
        image: "alpine:latest".into(),
        command: Some(Path::new("echo").into()),
        args: vec!["hello".into(), "world".into()],
        ..Default::default()
    })
    .enable_capture()
    .run()?;
assert_eq!(output.stdout_string_lossy(), "hello world\n");

TODO

Only a few Docker commands are currently implemented, and many of the available options for those commands are not yet implemented. Contributions welcome!

Commit count: 74

cargo fmt