Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to access a hardware device with a Docker image under Windows?

Tags:

docker

windows

Recently, a native Docker client for Windows was released (>= Windows 7).

I wonder: is it possible to forward access to physical devices, running Windows as host?

With a *nix host, this seems to be possible with the following syntax:

docker run -t -i --device=/dev/ttyUSB0 ubuntu bash

(as proposed here) which would forward the USB device /dev/ttyUSB0 on a *nix system to the docker image.

A description of the --device flag can be found in the docker docs.

What would be the syntax for a Windows host?

like image 971
Pascal Avatar asked May 17 '16 11:05

Pascal


People also ask

Can a container access hardware?

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.

Can Docker run a Windows image?

You can run any application in Docker as long as it can be installed and executed unattended, and the base operating system supports the app. Windows Server Core runs in Docker which means you can run pretty much any server or console application in Docker.

Can I run Linux Docker image on Windows?

Docker has been able to run Linux containers on Windows desktop since it was first released in 2016 (before Hyper-V isolation or Linux containers on Windows were available) using a LinuxKit based virtual machine running on Hyper-V.

Can Docker containers run on both Windows and Mac operating systems?

You can run both Linux and Windows programs and executables in Docker containers. The Docker platform runs natively on Linux (on x86-64, ARM and many other CPU architectures) and on Windows (x86-64). Docker Inc. builds products that let you build and run containers on Linux, Windows and macOS.


1 Answers

Windows USB devices are not currently available to Docker containers run with Docker for Windows.

Answered by a Docker staff member on the 7th of July 2017 in the Docker forum.

https://forums.docker.com/t/exposing-docker-to-usb-device-in-windows-10-with-docker-toolbox/29290/3

This answer is likely to get outdated in some time, provided they will allow for this feature somehow.

like image 137
dbalakirev Avatar answered Oct 22 '22 07:10

dbalakirev