Back to Explore

sindresorhus/is-docker

GitHub
1 watchersOpen source

Last release:

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

  • Maintenance status: The source appears actively maintained in the short term, with a recent upstream push and published updates in 2025 (last known push: 2025-09-15).
  • Update cadence: After a long gap between v3.0.0 (2021-08-31) and v4.0.0 (2025-09-15), the project has shown renewed activity, but the evidence does not show a steady ongoing cadence beyond that single later update.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v4.0.0

    Release 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.

    Breaking
  • v3.0.0

    v3.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.

    Breaking
  • v2.2.1

    v2.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

    v2.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

    v2.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

    v2.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.

    Features
  • v2.0.0

    v2.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