# amicontained

> Find out what container runtime is being used as well as features available. Ported from the Go version.

Latest version **1.0.0** (published 2017-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install amicontained
pnpm add amicontained
yarn add amicontained
bun add amicontained
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-08-18 |
| First published | 2017-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Christophe Robin |
| Maintainers | crobin |

## Links

- npm: https://www.npmjs.com/package/amicontained
- Repository: https://github.com/christopherobin/node-amicontained
- Homepage: https://github.com/christopherobin/node-amicontained#readme
- Issues: https://github.com/christopherobin/node-amicontained/issues
- npm.io page: https://npm.io/package/amicontained

## Dependencies (1)

- [async](https://npm.io/package/async.md) ^2.5.0

## Recent versions

- 1.0.0 (latest) — 2017-08-18

## README

# amicontained

This package helps detect if an application is currently running in a container.

## Installation

```
npm install amicontained
```

## Usage / API

```js
const amicontained = require('amicontained');

amicontained.amIContained((err, result) => {
	if (err) {
		return console.error(err);
	}

	if (result) {
		console.log('I am running in a container!');
	} else {
		console.log('I am not running in a container!');
	}
});

amicontained.runtime((err, runtime) => {
	if (err) {
		return console.error(err);
	}

	console.log(`Current container runtime is ${runtime}`);
});

amicontained.hasPIDNamespace((err, result) => {
	if (err) {
		return console.error(err);
	}

	if (result) {
		console.log('PID is namespaced!');
	} else {
		console.log('PID is not namespaced!');
	}
});

amicontained.appArmorProfile((err, profile) => {
	if (err) {
		return console.error(err);
	}

	console.log(`Current apparmor profile is:\n\n${profile}`);
});
```

Running this file with docker would yield:

```bash
$ docker run --rm -it my-container:latest
I am contained!
Current container runtime is docker
PID is namespaced!
```

### Promise-based

To use the API with promises, you can do:

```js
const amicontained = require('amicontained').promisify();

amicontained.runtime().then((result) => {
	console.log(`Current container runtime is ${runtime}`);
});
```

Or if your version of node supports async/await:

```js
const amicontained = require('amicontained').promisify();

async function main() {
	const runtime = await amicontained.runtime();
	console.log(runtime);
}

main();
```

## License

MIT

---
_Source: https://npm.io/package/amicontained · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
