container-what 0.1.0

Detect if we are running in a container.
Documentation
  • Coverage
  • 0%
    0 out of 18 items documented0 out of 7 items with examples
  • Size
  • Source code size: 9.55 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.97 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • Documentation
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • realityone

container-what

Detect if we are running in a container.

Looks like virt-what, but aim to container engines.

More container engines will be added.

Installation

Put this crate in your Cargo.toml.

[dependencies]
container_what = "*"

Usage

extern crate container_what;

use std::path::Path;

use container_what::container::ContainerEngine;
use container_what::common::{Detector, DetectorContext};
use container_what::container::detector::ContainerDetector;


fn main() {
    // Specify the detect root
    let ref ctx = DetectorContext::new(Path::new("/root"));
    assert_eq!(ContainerDetector::detect(ctx), ContainerEngine::Docker);
}

License

container-what is licensed under the MIT License - see the LICENSE file for details