Socket
Socket
Sign inDemoInstall

is-docker

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 2.0.0

index.d.ts

18

index.js
'use strict';
var fs = require('fs');
const fs = require('fs');
var isDocker;
let isDocker;

@@ -10,3 +10,3 @@ function hasDockerEnv() {

return true;
} catch (err) {
} catch (_) {
return false;

@@ -18,4 +18,4 @@ }

try {
return fs.readFileSync('/proc/self/cgroup', 'utf8').indexOf('docker') !== -1;
} catch (err) {
return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
} catch (_) {
return false;

@@ -25,9 +25,5 @@ }

function check() {
return hasDockerEnv() || hasDockerCGroup();
}
module.exports = function () {
module.exports = () => {
if (isDocker === undefined) {
isDocker = check();
isDocker = hasDockerEnv() || hasDockerCGroup();
}

@@ -34,0 +30,0 @@

{
"name": "is-docker",
"version": "1.1.0",
"description": "Check if the process is running inside a Docker container",
"license": "MIT",
"repository": "sindresorhus/is-docker",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"detect",
"docker",
"dockerized",
"container",
"inside",
"is",
"env",
"environment",
"process"
],
"devDependencies": {
"ava": "*",
"sinon": "^1.14.1",
"xo": "^0.16.0"
}
"name": "is-docker",
"version": "2.0.0",
"description": "Check if the process is running inside a Docker container",
"license": "MIT",
"repository": "sindresorhus/is-docker",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"detect",
"docker",
"dockerized",
"container",
"inside",
"is",
"env",
"environment",
"process"
],
"devDependencies": {
"ava": "^1.4.1",
"sinon": "^7.3.2",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}

@@ -9,3 +9,3 @@ # is-docker [![Build Status](https://travis-ci.org/sindresorhus/is-docker.svg?branch=master)](https://travis-ci.org/sindresorhus/is-docker)

```
$ npm install --save is-docker
$ npm install is-docker
```

@@ -12,0 +12,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc