https://github.com/denorg/is-docker
🐳 Check if the process is running inside a Docker container in Deno
https://github.com/denorg/is-docker
deno denoland denorg docker typescript
Last synced: 3 months ago
JSON representation
🐳 Check if the process is running inside a Docker container in Deno
- Host: GitHub
- URL: https://github.com/denorg/is-docker
- Owner: denorg
- License: mit
- Created: 2020-05-22T15:16:35.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-25T12:05:59.000Z (about 5 years ago)
- Last Synced: 2024-11-01T23:04:41.392Z (over 1 year ago)
- Topics: deno, denoland, denorg, docker, typescript
- Language: TypeScript
- Homepage: https://denorg.github.io/is-docker/
- Size: 542 KB
- Stars: 1
- Watchers: 7
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# 🐳 Is Docker
Check if the process is running inside a Docker container in Deno.
[](https://github.com/denorg/is-docker/actions)
[](https://github.com/denorg/is-docker/blob/master/LICENSE)
[](https://github.com/denorg/is-docker/graphs/contributors)
[](https://denorg.github.io/starter/)
[](https://github.com/denorg)
[](https://github.com/denorg/is-docker)
[](https://github.com/semantic-release/semantic-release)
## ⭐ Getting started
Import the `isDocker` function and use it:
```ts
import { isDocker } from "https://deno.land/x/is_docker/mod.ts";
const inDockerContainer = await isDocker(); // boolean
```
### CLI with [DPX](https://github.com/denorg/dpx)
After [installing DPX](https://github.com/denorg/dpx), you can directly use the CLI using the `dpx` command:
```bash
dpx is_docker --allow-read
# You are not in a Docker environment
```
### CLI
Alternatively, you can use it directly from the CLI by using `deno run`:
```bash
deno run --allow-read https://deno.land/x/is_docker/cli.ts
```
You can also install it globally using the following:
```bash
deno install --allow-read -n is_docker https://deno.land/x/is_docker/cli.ts
```
Then, the package is available to run:
```bash
is_docker
# You are in a Docker environment
```
### Configuration
Required permissions:
1. `--allow-read`
## 👩💻 Development
Run tests:
```bash
deno test --allow-read
```
## ⭐ Related Work
- [sindresorhus/is-docker](https://github.com/sindresorhus/is-docker) is the Node.js project serving as inspiration for this one
## 📄 License
MIT © [Denorg](https://den.org.in)
A project by Denorg, the world's first Deno-focused community
organization and consulting company. Work with us →