Skip to content
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

USB Passthrough on macOS #511

Open
michaelweinold opened this issue Jul 17, 2023 · 4 comments
Open

USB Passthrough on macOS #511

michaelweinold opened this issue Jul 17, 2023 · 4 comments
Assignees
Labels
community_new New idea raised by a community contributor

Comments

@michaelweinold
Copy link

michaelweinold commented Jul 17, 2023

Tell us about your request

At the suggestion of @djs55, I am creating a feature request for a macOS USB passthrough feature, which was previously discussed at:

and

Which service(s) is this request for?

Docker Desktop (macOS)

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?

I would like to connect an SDR dongle to a docker container running on my Mac.

Are you currently working around the issue?

A recent blog post (linked in this popular StackOverflow question) describes a workaround based on installing docker in a VirtualBox.

Note: An issue has recently been opened in the for-mac repo:

@michaelweinold michaelweinold added the community_new New idea raised by a community contributor label Jul 17, 2023
@hongkongkiwi
Copy link

I too would like this feature, as it's already implemented in hyperkit, we just need docker for mac to add support for this.

@nospam2000
Copy link

nospam2000 commented Sep 29, 2023

I also would like to use it for SDR receivers.

In theory it is possible to share SDR receivers via network, but to make this work it requires to increase the network buffer size which unfortunately is also not possible, so there is no workaround.

so this doesn't work in docker-compose:

    sysctls:
      net.core.rmem_max: 104857600
      net.core.wmem_max: 104857600

see also /usr/share/doc/soapyremote-server/README.Debian and https://medium.com/mercedes-benz-techinnovation-blog/tuning-network-sysctls-in-docker-and-kubernetes-766e05da4ff2

@thaJeztah
Copy link
Member

so this doesn't work in docker-compose:

Having a quick look, but it's probably not a limitation of compose; it looks like those sysctls may not be namespaced, and therefore not available within the container's namespace; you can see them when running with --network=host (which disables the container's networking namespace, and uses the networking namespace of the host (VM in case of Docker Desktop), but updating those would mean you're updating the host's configuration (not just for the container);

The rmem_max and wmem_max options are not available inside the container;

docker run --rm alpine ls -l /proc/sys/net/core/
total 0
-rw-r--r--    1 root     root             0 Sep 29 08:30 somaxconn
-rw-r--r--    1 root     root             0 Sep 29 08:30 xfrm_acq_expires
-rw-r--r--    1 root     root             0 Sep 29 08:30 xfrm_aevent_etime
-rw-r--r--    1 root     root             0 Sep 29 08:30 xfrm_aevent_rseqth
-rw-r--r--    1 root     root             0 Sep 29 08:30 xfrm_larval_drop

# trying to set those systctls will fail:
docker run --rm --sysctl net.core.rmem_max=104857600 --sysctl net.core.wmem_max=104857600 alpine sh -c 'ulimit -a'

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: open /proc/sys/net/core/wmem_max: no such file or directory: unknown.

With host networking, these are shown;

docker run --rm --network=host alpine ls -l /proc/sys/net/core/
total 0
-rw-r--r--    1 root     root             0 Sep 29 08:30 bpf_jit_enable
-rw-------    1 root     root             0 Sep 29 08:30 bpf_jit_harden
-rw-------    1 root     root             0 Sep 29 08:30 bpf_jit_kallsyms
-rw-r--r--    1 root     root             0 Sep 29 08:30 busy_poll
-rw-r--r--    1 root     root             0 Sep 29 08:30 busy_read
-rw-r--r--    1 root     root             0 Sep 29 08:30 default_qdisc
-rw-r--r--    1 root     root             0 Sep 29 08:30 dev_weight
-rw-r--r--    1 root     root             0 Sep 29 08:30 dev_weight_rx_bias
-rw-r--r--    1 root     root             0 Sep 29 08:30 dev_weight_tx_bias
-rw-r--r--    1 root     root             0 Sep 29 08:30 flow_limit_cpu_bitmap
-rw-r--r--    1 root     root             0 Sep 29 08:30 flow_limit_table_len
-rw-r--r--    1 root     root             0 Sep 29 08:30 max_skb_frags
-rw-r--r--    1 root     root             0 Sep 29 08:30 message_burst
-rw-r--r--    1 root     root             0 Sep 29 08:30 message_cost
-rw-r--r--    1 root     root             0 Sep 29 08:30 netdev_budget
-rw-r--r--    1 root     root             0 Sep 29 08:30 netdev_budget_usecs
-rw-r--r--    1 root     root             0 Sep 29 08:30 netdev_max_backlog
-r--r--r--    1 root     root             0 Sep 29 08:30 netdev_rss_key
-rw-r--r--    1 root     root             0 Sep 29 08:30 netdev_tstamp_prequeue
-rw-r--r--    1 root     root             0 Sep 29 08:30 optmem_max
-rw-r--r--    1 root     root             0 Sep 29 08:30 rmem_default
-rw-r--r--    1 root     root             0 Sep 29 08:30 rmem_max
-rw-r--r--    1 root     root             0 Sep 29 08:30 rps_sock_flow_entries
-rw-r--r--    1 root     root             0 Sep 29 08:30 somaxconn
-rw-r--r--    1 root     root             0 Sep 29 08:30 tstamp_allow_data
-rw-r--r--    1 root     root             0 Sep 29 08:30 warnings
-rw-r--r--    1 root     root             0 Sep 29 08:30 wmem_default
-rw-r--r--    1 root     root             0 Sep 29 08:30 wmem_max
-rw-r--r--    1 root     root             0 Sep 29 08:30 xfrm_acq_expires
-rw-r--r--    1 root     root             0 Sep 29 08:30 xfrm_aevent_etime
-rw-r--r--    1 root     root             0 Sep 29 08:30 xfrm_aevent_rseqth
-rw-r--r--    1 root     root             0 Sep 29 08:30 xfrm_larval_drop

@bsousaa
Copy link
Collaborator

bsousaa commented Jan 18, 2024

related thread docker/for-mac#900

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community_new New idea raised by a community contributor
Projects
None yet
Development

No branches or pull requests

7 participants