title | description | author | ms.author | ms.date | ms.topic |
---|---|---|---|---|---|
Devices in containers on Windows |
Learn about device support for containers on Windows. |
sethmanheim |
sethm |
10/20/2020 |
how-to |
By default, Windows containers are given minimal access to host devices--just like Linux containers. There are certain workloads where it is beneficial--or even imperative--to access and communicate with host hardware devices. This guide covers which devices are supported in containers and how to get started.
For this feature to work, your environment must meet the following requirements:
- The container host must be running Windows Server 2019 or Windows 10, version 1809 or newer.
- Your container base image version must be 1809 or later.
- Your containers must be Windows containers running in process-isolated mode.
- The container host must be running Docker Engine 19.03 or newer.
To start a container with a device, use the following command:
docker run --isolation=process --device="class/{interface class GUID}" mcr.microsoft.com/windows/servercore:1809
You must replace the {interface class guid}
with an appropriate device interface class GUID, which can be found in the section below.
To start a container with multiple devices, use the following command and string together multiple --device
arguments:
docker run --isolation=process --device="class/{interface class GUID}" --device="class/{interface class GUID}" mcr.microsoft.com/windows/servercore:1809
In Windows, all devices declare a list of interface classes that they implement. By passing this command to Docker, it will ensure that all devices which identify as implementing the requested class will be plumbed into the container.
This means you are not assigning the device away from host. Instead, the host is sharing it with the container. Likewise, because you are specifying a class GUID, all devices that implement that GUID will be shared with the container.
The following devices (and their device interface class GUIDs) are supported today:
Device Type | Interface Class GUID |
---|---|
GPIO | 916EF1CB-8426-468D-A6F7-9AE8076881B3 |
I2C Bus | A11EE3C6-8421-4202-A3E7-B91FF90188E4 |
COM Port | 86E0D1E0-8089-11D0-9CE4-08003E301F73 |
SPI Bus | DCDE6AF9-6610-4285-828F-CAAF78C424CC |
DirectX GPU Acceleration | See GPU acceleration docs |
Important
Device support is driver-dependent. Attempting to pass class GUIDs not defined in the table above may result in undefined behavior.
Device assignment and device sharing for workloads in Hyper-V-isolated Windows containers is not currently supported.
Device assignment and device sharing for workloads in Hyper-V-isolated Linux containers is not currently supported.