Detect if the current Node.js process is running inside a Docker container.
is-docker is a Node.js package that detects whether the current process is running inside a Docker container. It solves the problem of programmatically determining runtime context, which is useful for applications that need to adjust behavior, logging, or configuration between local and containerized environments. The package provides both a JavaScript API and a CLI tool for easy integration into scripts and workflows.
Node.js developers and DevOps engineers building applications that run in both Docker containers and traditional environments, and who need to automate context-aware behavior.
Developers choose is-docker for its simplicity, reliability, and zero dependencies—it's a focused solution that does one thing well without unnecessary complexity, making it easy to integrate and trust in production systems.
Check if the process is running inside a Docker container
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Has no external dependencies, ensuring fast installation, minimal footprint, and reduced security risks as highlighted in the README.
Provides a command-line interface that exits with code 0 for Docker and 2 for not, making it easy to integrate into automation scripts and workflows.
Includes built-in TypeScript definitions for better type safety and developer experience in typed projects, as noted in the features.
Checks Docker-specific environment files and cgroup information for accurate container detection, offering a dependable solution.
Limited to detecting Docker containers only, not other runtimes like Podman or Kubernetes pods, which can be a drawback in mixed environments.
As a minimalist library, it offers no configuration to adjust detection behavior or handle edge cases, which may restrict advanced use.
Cannot be used directly in other programming languages, requiring porting or alternative solutions for polyglot projects.