Initial commit

This commit is contained in:
Developer
2025-04-21 16:03:20 +02:00
commit 2832896157
22874 changed files with 3092801 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env node
'use strict';
const isDocker = require('.');
process.exitCode = isDocker() ? 0 : 2;

View File

@@ -0,0 +1,15 @@
/**
Check if the process is running inside a Docker container.
@example
```
import isDocker = require('is-docker');
if (isDocker()) {
console.log('Running inside a Docker container');
}
```
*/
declare function isDocker(): boolean;
export = isDocker;

View File

@@ -0,0 +1,29 @@
'use strict';
const fs = require('fs');
let isDocker;
function hasDockerEnv() {
try {
fs.statSync('/.dockerenv');
return true;
} catch (_) {
return false;
}
}
function hasDockerCGroup() {
try {
return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
} catch (_) {
return false;
}
}
module.exports = () => {
if (isDocker === undefined) {
isDocker = hasDockerEnv() || hasDockerCGroup();
}
return isDocker;
};

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,76 @@
{
"_from": "is-docker@^2.0.0",
"_id": "is-docker@2.2.1",
"_inBundle": false,
"_integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
"_location": "/is-docker",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "is-docker@^2.0.0",
"name": "is-docker",
"escapedName": "is-docker",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/node-notifier/is-wsl"
],
"_resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
"_shasum": "33eeabe23cfe86f14bde4408a02c0cfb853acdaa",
"_spec": "is-docker@^2.0.0",
"_where": "D:\\developments\\teaser-inertia\\nova-components\\NovaLeader\\node_modules\\node-notifier\\node_modules\\is-wsl",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"bin": {
"is-docker": "cli.js"
},
"bugs": {
"url": "https://github.com/sindresorhus/is-docker/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Check if the process is running inside a Docker container",
"devDependencies": {
"ava": "^1.4.1",
"sinon": "^7.3.2",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"engines": {
"node": ">=8"
},
"files": [
"index.js",
"index.d.ts",
"cli.js"
],
"funding": "https://github.com/sponsors/sindresorhus",
"homepage": "https://github.com/sindresorhus/is-docker#readme",
"keywords": [
"detect",
"docker",
"dockerized",
"container",
"inside",
"is",
"env",
"environment",
"process"
],
"license": "MIT",
"name": "is-docker",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/is-docker.git"
},
"scripts": {
"test": "xo && ava && tsd"
},
"version": "2.2.1"
}

View File

@@ -0,0 +1,27 @@
# is-docker
> Check if the process is running inside a Docker container
## Install
```
$ npm install is-docker
```
## Usage
```js
const isDocker = require('is-docker');
if (isDocker()) {
console.log('Running inside a Docker container');
}
```
## CLI
```
$ is-docker
```
Exits with code 0 if inside a Docker container and 2 if not.