4 releases

Uses new Rust 2021

0.1.3 Apr 23, 2022
0.1.2 Apr 23, 2022
0.1.1 Apr 23, 2022
0.1.0 Apr 15, 2022

#1119 in Development tools

MIT license

37KB
834 lines

example workflow

contain-rs

A tool to use podman containers with rust.

Docker is planned, as well. I just happened to start with podman since I tend to like a lot.

TODO

  • improve error types
  • improve error reporting
  • handle std error for child processes
  • implement exposed ports
  • check status before running commands
  • extract comman parts into shared module
  • implement healthcheck wait strategy
  • create image macro, to create new images from structs easily
  • care for stderr
  • add docker implementation
  • add a few images

lib.rs:

A crate to schedule and manage containers.

This crate might probably espacially interesting for testing.

Basic usage

use contain_rs::{
    client::{podman::Podman, Client, Handle},
    container::{Container, Image},
};

let podman = Podman::new();

let container = Container::from_image(Image::from_name("docker.io/library/nginx"));

let handle = podman.create(container);

handle.run()

// when the handle gets out of scope the container is stopped and removed

Clients

There are going to be different clients. Docker and podman are both planned for now.

Focus lies on the podman client though, which you can find here.

Images

Strictly speaking the types of this crate wouldn't exactly define an image as a thing that can be run.

Rather it would schedule containers. Which you can find a description of containers here.

Dependencies

~3.5–5MB
~104K SLoC