I'm trying to collect data on the access point from a Docker container.
Normally I'd just run
$ iw dev wlp0s20f3 link
Connected to 8e:5a:25:a6:7f:81 (on wlp0s20f3)
SSID: My Wifi
freq: 2462
RX: 2481914864 bytes (3224435 packets)
TX: 1036520417 bytes (1800629 packets)
signal: -54 dBm
rx bitrate: 144.4 MBit/s MCS 15 short GI
tx bitrate: 144.4 MBit/s MCS 15 short GI
bss flags: short-slot-time
dtim period: 3
beacon int: 100
parse that text and be done with it. However, my container must be run in bridge mode, so I don't have access to the underlying device information.
I can mount read-only volumes /sys/class/net
, but it doesn't seem to get me all the information I need. I can mount /proc/net/wireless
, but the interface information I care about doesn't show up.
How might I access live data from a docker container in bridge mode? Specifically I'm looking for this information:
Try nsenter, it will execute command on the host if container was started in privileged mode
/bin/bash
arg=${@}
nsenter --target 1 --mount --uts --net --ipc ${arg}
./host_cmd ip link
./host_cmd: line 1: !/bin/bash: No such file or directory
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: tap0: <BROADCAST,UP,LOWER_UP> mtu 65520 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 2e:8d:3c:fc:d9:20 brd ff:ff:ff:ff:ff:ff
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.