contain-rs
A tool to use docker and podman containers with rust.
For usage take a look at the Documentation
Basic usage
use ;
use FromStr;
let podman = new;
let container = from_image;
let handle = podman.create;
handle.run;
handle.wait;
// when the handle gets out of scope the container is stopped and removed
Clients
Clients are used for scheduling containers. There are currently two implementations available. One of them works with docker the other one uses podman.
Images
Containers need image to run. You can create images like so:
use Image;
use FromStr;
let image = from_str;
assert!;
let latest = from_str;
assert!;
Macro
Contain-rs provides a derive macro to implement the IntoContainer trait for a struct. The macros feature has to be enabled to make use of the derive macro.
You can then create a container like this:
use *;
let client = default;
let nginx = client.create;
nginx.run;
nginx.wait;
nginx.rm; // stops and removes the container
// this would be done automatically when the container handle goes out of scope