diff --git a/README.md b/README.md index c9fcf5e..c5296e0 100644 --- a/README.md +++ b/README.md @@ -4,38 +4,48 @@ Check if the process is running inside a Docker container in Deno. [![Test CI](https://github.com/denorg/is-docker/workflows/Test%20CI/badge.svg)](https://github.com/is-docker/starter/actions) +## ⭐ Getting started + +Import the `isDocker` function and use it: + ```ts import { isDocker } from "https://deno.land/x/is_docker/mod.ts"; -const checkDocker = async () => { - if (await isDocker()) { - console.log('You are inside docker environment!'); - } else { - console.log('You are not in docker environment!'); - } -} +const inDockerContainer = await isDocker(); // boolean +``` + +### CLI with [DPX](https://github.com/denorg/dpx) -checkDocker(); +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 ``` -Alternatively, you can use it directly from the CLI by using deno run: +### 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 +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 +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`