#docker #command #container #run #podman #depend

deprecated docker-command

Library for creating Docker commands

12 releases (7 stable)

5.0.1 Mar 20, 2024
5.0.0 Nov 24, 2021
4.0.0 Nov 24, 2021
3.0.0 Nov 17, 2021
0.7.0 Sep 12, 2020

#30 in #podman

Download history 15/week @ 2024-01-10 3/week @ 2024-01-17 9/week @ 2024-02-14 52/week @ 2024-02-21 46/week @ 2024-02-28 15/week @ 2024-03-06 171/week @ 2024-03-13 543/week @ 2024-03-20 98/week @ 2024-03-27 44/week @ 2024-04-03 24/week @ 2024-04-10 70/week @ 2024-04-17 7/week @ 2024-04-24

220 downloads per month
Used in 2 crates (via aws-build-lib)

Apache-2.0

19KB
341 lines

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!

Dependencies

~0.1–7MB
~41K SLoC