How to connect USB wireless interface to a Docker container on Mac OS X?
Asked Answered
F

0

7

I have a Linux Docker container which needs a wireless interface to work. On Linux (running it at a Linux host) I have no problem with that.

Running Docker container with arguments --privileged and --net=host I can access the host wireless interfaces, and I can manage them without any issue. The problem is when I run the same Linux Docker container on a Mac OS X host. I can't see the wireless interface inside the Docker container.

This is the output of ifconfig at Mac OS X v10.12 (Sierra) host:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
    inet 127.0.0.1 netmask 0xff000000
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
    nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=b<RXCSUM,TXCSUM,VLAN_HWTAGGING>
    ether 00:0c:29:fe:78:07
    inet6 fe80::8ff:62ac:e141:5aa9%en0 prefixlen 64 secured scopeid 0x4
    inet 192.168.0.153 netmask 0xffffff00 broadcast 192.168.0.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (1000baseT <full-duplex>)
    status: active
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 00:c0:ca:5a:00:f2
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (<unknown type>)
    status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
    inet6 fe80::7a12:53b9:61c3:3c7%utun0 prefixlen 64 scopeid 0x6
    nd6 options=201<PERFORMNUD,DAD>

The "en1" interface is the wireless usb device. Now the ifconfig output inside the container run with the parameters described:

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 0.0.0.0
        ether 02:42:67:b5:aa:36  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.65.2  netmask 255.255.255.248  broadcast 192.168.65.7
        inet6 fe80::b564:23a5:1418:8f2a  prefixlen 64  scopeid 0x20<link>
        ether c0:ff:ee:c0:ff:ee  txqueuelen 1000  (Ethernet)
        RX packets 22  bytes 2418 (2.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 33  bytes 3100 (3.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 3  bytes 54 (54.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3  bytes 54 (54.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I guess the container's eth0 is "mapped" to the en0 interface and is working, and I have Internet access inside the container. But, why am I not seeing en1 mapped to any device on container?

How do I achieve this on Mac OS X? If I remove the --net=host from the command line to launch Docker, the interface docker0 disappears inside the container... is the difference, but wireless interface doesn't appear in any case.

Fellini answered 8/4, 2017 at 10:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.