---
title: Host devices should not be directly exposed to containers
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > Host devices should not be directly
  exposed to containers
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Host devices should not be directly exposed to containers
Classification:complianceFramework:cis-dockerControl:5.18 
## Description{% #description %}

Containers should have no host device mapped into them.

## Rationale{% #rationale %}

A container given a host device can read and write it, a disk among others, below every file permission of the host.

## Audit{% #audit %}

Inspect the containers:

```bash
docker ps --quiet --all | xargs docker inspect --format '{{ .Name }}: Devices={{ .HostConfig.Devices }} DeviceRequests={{ .HostConfig.DeviceRequests }} DeviceCgroupRules={{ .HostConfig.DeviceCgroupRules }}'
```

Datadog passes the rule when a container maps no host device, with `--device`, `--gpus` or a device cgroup rule, and fails it otherwise. A container that needs a device, such as a GPU, fails and needs a manual review.

## Remediation{% #remediation %}

Run the container without `--device`, or with only the devices it needs and the narrowest permissions, such as `--device=/dev/xvdc:/dev/xvdc:r`.

## Impact{% #impact %}

None.

## Default value{% #default-value %}

Containers get the default devices of Docker, such as `/dev/null` and `/dev/zero`.

## References{% #references %}

1. [https://docs.docker.com/reference/cli/docker/container/run/#add-host-device-to-container—device](https://docs.docker.com/reference/cli/docker/container/run/#add-host-device-to-container---device)
