-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exposing a tty serial device requires privileged and doesn't work #900
Comments
Unfortunately the Mac and Linux are running in different operating systems and cannot see the same devices. I think there are some existing issues, the way to implement it will differ for different device types, but it is not trivial. |
Take a look at boot2docker/boot2docker#707 for some discussion on this topic. |
That all makes sense. Should we have some sort of error instead of a silent failure? |
As @justincormack says this is (probably) possible but is likely to be non-trivial and is not currently a priority for us. I will file a wishlist ticket for this internally. Please 👍 the top comment if you are interested in this feature. |
@ijc25 Just curious: if I could convince my client to throw some money at this specifically, would that bump the priority? |
If someone (or someone's client's hired contractor) was to raise a PR against https://github.com/docker/hyperkit which added the necessary underlying support for USB device passthrough (i.e. causing the USB device to appear within the VM so the Linux usb tty class driver can be run on top) or adding some sort of serial/tty passthrough functionality (I'm not sure how that would look, but it might be a plausible approach) and work with the team to get that PR into an acceptable state to be merged into hyperkit then it ought then to be possible for d4m users to fudge things themselves to enable the passthrough locally, although it clearly wouldn't be a Supported d4m feature. Maybe d4m could supply a (most likely also unsupported) way to add hyperkit command line options to enable people to do this sort of thing more easily (at their own risk, get to keep both pieces if it breaks etc). Another plausible alternative (and likely much simpler to achieve than passthrough if it works) might be to investigate libusb and/or usb over ip between your container and a daemon on the host, it's possible that might even be possible to setup without changes to either hyperkit or d4m (AIUI the wire protocol is intended to be portable, i.e. Mac talking to Linux is supposed to work, I don't know if that is really true though). |
One direction to achieve a workaround is with USB over IP for which a few commercial solutions exist. Nevertheless, the Docker VM that is based on Alpine Linux does not include all necessary kernel modules ( |
together with #77 and the dreadful (know limitations) in https://docs.docker.com/docker-for-mac/networking/ these are the showstoppers for using Docker on OSX from my point of view and the comment "not currently a priority for us" is not what I would have expected. For a viable business I would expect that necessary / mandatory things to make virtualization useful should be high on the priority list. If I can not access simple devices like my usb devices or disk from a container what use can I make of container based virtualization? I'll have to still use VMWare and what is worse if i like docker I will have to go thru all kinds of tricks to make VMWare my host environment and docker work together. When I first learned about docker I found the idea of having the option to run containers based on the same Dockerfile in windows, linux and Mac OS environments great. In the meantime I am more than disapppointed. Currently I think there is a complete failure of Docker to deliver on this idea in real world projects that need access to disks, network, graphics and devices. |
@WolfgangFahl Don't be so upset, the Docker Inc. has shown numerous times, that they do not care about the problems and use cases of small users. They even reject pretty well-designed pull requests that solve various issues. |
second this one. makes docker pretty much unusable for anything but web services .. |
Basic networking and device pass-throughs from the host to the guest system are table stakes for virtualization. I was excited to start using the OSX Docker but quickly realized that it's just not ready yet. |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
/remove-lifecycle stale |
I need to install Linux to my MacBook right now, just for this limitation. I'd be great if Docker Inc. would consider working on this issue. |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Any update on if this feature will get implemented in docker? USB Passthrough? I also found this roadmap issue. |
just a PSA, there are other alternatives for running containers on a Mac, for example:
i dont know whether any of these support USB passthrough as i dont need this feature anymore (solved my problem by using a different machine), but someone could experiment with these and maybe find an alternative solution to this (very old) issue |
I had no luck with Colima
…On Sun, Dec 3, 2023 at 15:04 Laszlo Boros ***@***.***> wrote:
just a PSA, there are other alternatives for running containers on a Mac,
for example:
- https://github.com/abiosoft/colima
- https://github.com/kubernetes/minikube (tutorial to use it for
docker:
https://itnext.io/goodbye-docker-desktop-hello-minikube-3649f2a1c469 )
- and this one: https://macoscontainers.org/
i dont know whether any of these support USB passthrough as i dont need
this feature anymore (solved my problem by using a different machine), but
someone could experiment with these and maybe find an alternative solution
to this (very old) issue
—
Reply to this email directly, view it on GitHub
<#900 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATHYSZJU74S6FA7AITHYSHDYHUAPXAVCNFSM4CVJOKW2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBTG43DGMBSGEYQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Another PSA: https://christopherjmcclellan.wordpress.com/2019/04/21/using-usb-with-docker-for-mac/ describes how to USB forward to a docker daemon run in VirtualBox on macOS. I haven't personally tried yet. |
This uses |
I’m actually the author of that blog. |
I also don’t know what the odds of this are, but this xkcd dropped today. |
I thought I muted this thread long ago but you just made me laugh at loud, so I guess I'm glad I didn't. I hope everyone here is making cool stuff and having fun doing it. -Francis |
Same here, bought a Zooz dongle figuring I could connect to my zwave thermostat from my Mac. Oh well, another perfectly good tech gadget for the maybe-useful-in-the-future box in the basement. Edit: Just to update, I've solved my immediate problem by using ser2net to host the USB dongle on a TCP port. I connect to that with zwave-js-ui (Docker), and finally with Home Assistant (Docker). It's been running without issue for a week now. |
Boooo! |
@jemdiggity wrote:
Do not do this. It is not kind to the people who spend their life writing software that you will use for free. -- your friend from xkcd 2881, who has also been an open source project maintainer on occasion. |
WSL uses usbipd to tunnel USB over IP, maybe that would be an acceptable workaround for some here? It will require custom logic inside the docker image to un-tunnel it, so it's not fully transparent. |
hey @ginjo, I'm in the same exact situation. Do mind sharing how you got that working? |
@christiandennis , Sure I'll try to describe the essential parts here, if it's not too lengthy. I'll come back and edit this comment when I get something written up. Update: Ok here's a gist with a basic writeup describing my Home Assistant setup using zwave-js-ui and ser2net to access a USB z-wave stick over a TCP port from a Docker container. It's not an exhaustive writeup, but hopefully it will get you most of the way there. More specifically, this shows how to use ser2net to host a USB device on a TCP port, so it can be accessed from within a Docker container. basic_ha_zwave_docker_setup.md Update 2024-05-06: My production server is a linux machine (rPi), with my docker services running in Swarm mode. Since Swarm mode does not allow access to usb ports, even on linux, I used the ser2net workaround here as well. All good, however there is an even better way that is pure Docker: Have your swarm container launch a privileged non-swarm docker container which will allow access to the USB port. Some call this docker-in-docker, but it's more like docker-from-docker or docker-on-docker. Your swarm service container is merely a wrapper to launch a plain |
I too have run into this issue when attempting to mount nRF52480 Nordic Semiconductor DevKits while simultaneously trying to preserve my Mac / containerize the necessary toolchains needed to develop on that device. As commented upon for the last 8 years, there is a mismatch in the |
I am new to Docker and have been trying to use openocd to connect to a serial device that I have. It's crazy to me that this thread is that old with no fix in sight. boo 👎 |
Unfortunately docker is useless for anything other than building in a cloud pipeline. All my Nordic stuff has to be done an a VM because Docker can't do virtualization on a Mac. |
The "host" was been now add into docker after the ticket was been open for 6? years. |
Spent all day wondering what I was doing wrong. Found this. Glad I'm not the only one. Can't believe this has been a problem for so long. All I've ever heard is how great docker is suppose to be, and it is in some ways but this is a pretty big deal breaker for me. I have no experience with other virtualization software but I guess there is always a time to learn. |
I run docker in a Ubuntu VM in Parallels and that does allow access to the serial ports.
It is not free though, but parallels is useful for other stuff as well.
… On 6 May 2024, at 03:47, Jon ***@***.***> wrote:
Spent all day wondering what I was doing wrong. Found this. Glad I'm not the only one. Can't believe this has been a problem for so long. All I've ever heard is how great docker is suppose to be, and it is in some ways but this is a pretty big deal breaker for me. I have no experience with other virtualization software but I guess there is always a time to learn.
—
Reply to this email directly, view it on GitHub <#900 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AFOQOQS2W3G6TTVMDRV7XWDZA3OLRAVCNFSM4CVJOKW2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBZGUYDMNJWGQ2A>.
You are receiving this because you were mentioned.
|
What are you trying to do? I am doing embedded work and using ESP-IDF and using RFC2217 (TelNet) to flash a dev board from inside a running docker instance connected to my Mac. It is a PIA but for now it works.. I use the serial monitor the same way. Here is a link to the ESP-IDF document. |
@ucs308 you saved me a lot of time, thanks! |
stumbled back on this problem only to find I've visited this page a few years ago and forgotten. See you in another few years everyone and maybe we should get a beach house to celebrate if/when this becomes supported |
It seems there is a |
Expected behavior
That I can expose a tty dev device from my mac to a linux container by running.
Actual behavior
I can work past this with
--privileged
but I don't see it in/dev/
According to the docs on docker run I shouldn't need
--privileged
.Information
https://docs.docker.com/engine/reference/run/#/runtime-privilege-and-linux-capabilities
Steps to reproduce the behavior
/dev/tty.usbXXXX
device to the docker imageThe text was updated successfully, but these errors were encountered: