# is-docker

> Check if the process is running inside a Docker container

Latest version **4.0.0** (published 2025-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-docker
pnpm add is-docker
yarn add is-docker
bun add is-docker
```

Provides the command `is-docker`.

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2025-09-15 |
| First published | 2015-04-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 234 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | detect, docker, dockerized, container, inside, is, env, environment, process |

## Links

- npm: https://www.npmjs.com/package/is-docker
- Repository: https://github.com/sindresorhus/is-docker
- Homepage: https://github.com/sindresorhus/is-docker#readme
- Issues: https://github.com/sindresorhus/is-docker/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/is-docker

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 4.0.0 (latest) — 2025-09-15
- 3.0.0 — 2021-08-31
- 2.2.1 — 2021-04-09
- 2.2.0 — 2021-04-05
- 2.1.1 — 2020-08-04
- 2.1.0 — 2020-08-02
- 2.0.0 — 2019-04-19
- 1.1.0 — 2016-10-27
- 1.0.1 — 2016-05-18
- 1.0.0 — 2015-04-08

## README

# is-docker

> Check if the process is running inside a Docker container

## Install

```sh
npm install is-docker
```

## Usage

```js
import isDocker from 'is-docker';

if (isDocker()) {
	console.log('Running inside a Docker container');
}
```

## CLI

```sh
$ is-docker
```

Exits with code 0 if inside a Docker container and 2 if not.

```sh
$ is-docker && echo "Running in Docker" || echo "Not running in Docker"
```

## Related

- [is-inside-container](https://github.com/sindresorhus/is-inside-container) - Check if the process is running inside a container

---
_Source: https://npm.io/package/is-docker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
