docker-ctl
Crate for conveniently starting and stopping docker containers. This crate is a wrapper around the docker command line interface.
This crate is considered to be complete, and is in low maintenance mode. You are welcome to contribute support for more docker command via pull requests.
Installation
Add docker-ctl
to your project with:
Example
use Container;
use ;
// Create a new container, with the `alpine` image in interractive mode.
let mut container = configure
.set_interactive
.set_capture_stdio
.create;
/// Start the container
container.start.unwrap;
/// Run the `echo` command in the container
let mut stdin = container.take_stdin.unwrap;
stdin.write_all.unwrap;
/// Dropping `stdin` will terminate the container
drop;
/// Read the output
let mut buf = vec!;
container
.take_stdout
.unwrap
.read_to_end
.unwrap;
/// Print `Hellow World!\n` characters.
println!;