Skip to content

Commit

Permalink
Update README with DPX
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary authored May 24, 2020
1 parent 35a784a commit fb2a3f1
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <arguments>
```

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`
Expand Down

0 comments on commit fb2a3f1

Please sign in to comment.