Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qard/container-info
Parse container info from cgroups file
https://github.com/qard/container-info
cgroups containers docker kubernetes nodejs
Last synced: 24 days ago
JSON representation
Parse container info from cgroups file
- Host: GitHub
- URL: https://github.com/qard/container-info
- Owner: Qard
- License: other
- Created: 2018-12-21T00:31:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-11-18T02:34:59.000Z (about 3 years ago)
- Last Synced: 2024-04-13T22:20:29.520Z (7 months ago)
- Topics: cgroups, containers, docker, kubernetes, nodejs
- Language: JavaScript
- Size: 44.9 KB
- Stars: 7
- Watchers: 2
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# container-info
Parse container info from cgroups file.
## Install
```sh
npm install container-info
```## Usage
```js
const getContainerInfo = require('container-info')// Sync
const { containerId, podId } = getContainerInfo.sync()
console.log({ containerId, podId })// Async
getContainerInfo().then(({ containerId, podId }) => {
console.log({ containerId, podId })
})// Parse cgroup file contents
const { containerId, podId } = getContainerInfo.parse(`
1:name=systemd:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod90d81341_92de_11e7_8cf2_507b9d4141fa.slice/crio-2227daf62df6694645fee5df53c1f91271546a9560e8600a525690ae252b7f63.scope
`)
```