Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 627
Pavelr Avatar asked Sep 04 '16 13:09

Pavelr


People also ask

What is device mapper in Docker?

Device Mapper is a kernel-based framework that underpins many advanced volume management technologies on Linux. Docker's devicemapper storage driver leverages the thin provisioning and snapshotting capabilities of this framework for image and container management.

Does Docker use Cgroups?

Control Groups (cgroups) are a feature of the Linux kernel that allow you to limit the access processes and containers have to system resources such as CPU, RAM, IOPS and network. In this lab you will use cgroups to limit the resources available to Docker containers.

What is thin pool in Docker?

It specifies the min free space in GB in a thin pool required for a new device creation to succeed. This check applies to both free data space as well as free metadata space. Container creation (during docker pull or docker run ) fails if free space in thin pool is less than the value in Thin Pool Minimum Free Space .


1 Answers

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.

like image 161
Pavelr Avatar answered Oct 13 '22 01:10

Pavelr