# docker-container-id

> Parse /proc/self/cgroup to find you own docker container's id

Latest version **1.0.1** (published 2017-09-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install docker-container-id
pnpm add docker-container-id
yarn add docker-container-id
bun add docker-container-id
```

## 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.1 |
| Published | 2017-09-11 |
| First published | 2017-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 7.8 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Aaron Sikes |
| Maintainers | courajs |
| Keywords | docker, introspection |

## Links

- npm: https://www.npmjs.com/package/docker-container-id
- Repository: https://github.com/courajs/docker-container-id
- Homepage: https://github.com/courajs/docker-container-id#readme
- Issues: https://github.com/courajs/docker-container-id/issues
- npm.io page: https://npm.io/package/docker-container-id

## Recent versions

- 1.0.1 (latest) — 2017-09-11
- 1.0.0 — 2017-09-11

## README

# `docker-container-id`

This is a simple function to get the id of the docker container the
current process is running in. Not tested for Windows containers.

```
npm install --save docker-container-id
```

The function returns a promise for the conatiner id.

```js
const getId = require('docker-container-id');

async function() {
  console.log("I'm in container:", await getId());
}
```

If you don't appear to be in a docker container, the promise resolves
with `false`:
```js
const getId = require('docker-container-id');

async function() {
  let id = await getId();
  if (!id) {
    console.error("Woah, you need to containerize this thing!");
    process.exit(1);
  } else {
    // ...
  }
}
```

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