#command #run #docker #container #podman

docker-command

Library for creating Docker commands

11 releases (5 major breaking)

5.0.0 Nov 24, 2021
4.0.0 Nov 24, 2021
3.0.0 Nov 17, 2021
2.0.0 Nov 8, 2021
0.7.0 Sep 12, 2020

#4 in #docker-container

Download history 16/week @ 2022-11-25 19/week @ 2022-12-02 34/week @ 2022-12-09 16/week @ 2022-12-16 20/week @ 2022-12-23 16/week @ 2022-12-30 20/week @ 2023-01-06 18/week @ 2023-01-13 45/week @ 2023-01-20 35/week @ 2023-01-27 86/week @ 2023-02-03 30/week @ 2023-02-10 81/week @ 2023-02-17 21/week @ 2023-02-24 20/week @ 2023-03-03 37/week @ 2023-03-10

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

Apache-2.0

18KB
341 lines

docker-command

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

~200KB