Pavelr
Pavelr

Reputation: 131

Device mapping to container in docker lacks info

I have an Ubuntu VM with some virtual storage devices mounted and I want to map them to a docker container running there too. So I volumized the whole thing, mount points and also '/dev'. The devices do get recognized in the container, but for some reason lsblk -o SERIAL inside the container doesn't return anything, when in the VM it does. Also, running the python pyudev library functionality inside the container, I don't get the MODEL of the device either (in the VM I get the full info).

Anyone can shed light on why it happens? Thanks!

Upvotes: 7

Views: 954

Answers (1)

Pavelr
Pavelr

Reputation: 131

After some investigation, found out that smartctl from smartmontools library solves the issue (apt-get install smartmontools). Returns both the MODEL and SERIAL of the devices, from inside the docker container, as opposed to lsblk and lshw.

As I was using python to query the devices for the info, the appropriate wrapper library for smartctl is pySMART (pip install pySMART). Works like a charm.

Upvotes: 1

Related Questions