Crates.io | container-what |
lib.rs | container-what |
version | 0.1.0 |
source | src |
created_at | 2017-09-16 06:18:39.228301 |
updated_at | 2017-09-16 06:18:39.228301 |
description | Detect if we are running in a container. |
homepage | https://github.com/realityone/container-what |
repository | |
max_upload_size | |
id | 31955 |
size | 9,922 |
Detect if we are running in a container.
Looks like virt-what, but aim to container engines.
More container engines will be added.
Put this crate in your Cargo.toml
.
[dependencies]
container_what = "*"
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);
}
container-what is licensed under the MIT License - see the LICENSE file for details