> For the complete documentation index, see [llms.txt](https://dcli.onepub.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dcli.onepub.dev/dcli-api/cross-platform/docker/detecting-docker.md).

# Detecting Docker

The DCli api allows you to detect if you are running in a Docker container

## DockerShell

DCli has the ability to detect which shell (bash, powershell, zsh etc) that you are running under.

If you DCli app is used as the Docker ENTRYPOINT then your parent won't be a shell.

In this case calling Shell.current will return a DockerShell:

```dart
DockerShell shell = Shell.current;
```

Attributes of DockerShell.

* shell name is 'docker'
* loggedInUser = 'root'
* isPrivilegedUser will always be true

## Detecting if you are running in a Docker

Using DockerShell to detect if you are in a Docker container is not reliable as in some circumstances you DCli app will be run from within a standard shell (bash etc) within Docker

Instead use:

```dart
if (DockerShell.inDocker)
{
    /// do something docker
}
```

This method looks for the presence of /.dockerenv which Docker guarantee will exist.
