Checks whether the current process is running inside a Docker container. Useful for applications that need to detect their runtime environment, with both a Node.js API (import is-docker) and a CLI that exits with code 0 in Docker and 2 otherwise.
Project status
- Actively maintained, with the most recent upstream push on 2025-09-15 and a new major update v4.0.0 on 2025-09-15.
- Update cadence appears bursty rather than frequent, major updates were released in 2021 (v3.0.0) and earlier (v2.2.1 in 2021), with the next major update arriving in 2025 (v4.0.0).
AI summary generated Today
Recent updates
v4.0.0
8 months agoRelease v4.0.0 raises the minimum supported Node.js version to 20 and updates the Docker detection logic. The release notes mention only a general detection improvement, but the code shows a specific additional detection path using Linux mountinfo.
Breakingv3.0.0
8/31/2021v3.0.0 converts the package to a pure ESM implementation and updates the supported Node.js runtime versions. The runtime behavior (Docker detection via /.dockerenv and /proc/self/cgroup) is largely unchanged, but module/export wiring and tooling configuration changed.
Breakingv2.2.1
4/9/2021v2.2.1 is a revert of a prior change titled "Improve detection", intended to roll back behavior that caused more problems than it solved. The shipped code narrows Docker cgroup detection logic and adjusts test expectations for CI environments.
v2.2.0
4/5/2021v2.2.0 updates the Docker detection logic and switches the repository CI from Travis to GitHub Actions. The release notes only broadly mention “Improve detection”, but the code diff shows a specific change in how cgroup data is interpreted.
v2.1.1
8/4/2020v2.1.1 is a very small release with a minimal code change. The release notes only mention a typo fix, but the diff shows a change to the CLI exit code logic.
v2.1.0
8/2/2020v2.1.0 adds a command line interface for is-docker. In the code, a new cli.js entrypoint is introduced and package.json is updated to publish it as a bin executable.
Featuresv2.0.0
4/19/2019v2.0.0 introduces TypeScript type definitions for the package. The release also raises the minimum supported runtime to Node.js 8, which may require upgrading your environment.
BreakingFeatures