LoginSignup
8
7

More than 5 years have passed since last update.

DockerコンテナからはiSCSIカーネルモジュールが見えない件

Posted at

DockerコンテナからiSCSI直接マウントできたら幸せだなぁ。
たぶんできないだろうなぁ。と思ったらやっぱりできなかった。

コンテナにiSCSIイニシエータを導入したかった

  • ホストOSからCentOSのコンテナを起動
[root@hostos]# docker run --privileged -idt --name init centos /sbin/init
  • コンテナへアクセス
[root@hostos]# docker exec -it init /bin/bash
  • iSCSIイニシエータの導入
[root@container]# yum update -y
[root@container]# yum install -y iscsi-initiator-utils
[root@container]# iscsiadm -m discovery -t sendtargets -p 10.250.201.122
  • iSCSI用のカーネルモジュールが無いとエラーが出る
libkmod: kmod_module_insert_module: could not find module by name='iscsi_tcp'
iscsiadm: Could not insert module tcp. Kmod error -38
iscsiadm: iSCSI driver tcp is not loaded. Load the module then retry the command.

iscsiadm: Could not perform SendTargets discovery: iSCSI driver not found. Please make sure it is loaded, and retry the operation
  • ホストOSにカーネルモジュールが存在するか確認
[root@hostos]# find -name *iscsi_tcp*
./3.10.0-123.el7.x86_64/kernel/drivers/scsi/iscsi_tcp.ko
./3.10.0-123.el7.x86_64/kernel/drivers/scsi/libiscsi_tcp.ko
./3.10.0-229.14.1.el7.x86_64/kernel/drivers/scsi/iscsi_tcp.ko
./3.10.0-229.14.1.el7.x86_64/kernel/drivers/scsi/libiscsi_tcp.ko

ちゃんとある模様

  • コンテナにカーネルモジュールが存在するか確認
[root@container]# find -name *iscsi_tcp*

存在しない

  • ちなみに
[root@container]# ll -a /usr/lib/modules/
total 8
drwxr-xr-x.  2 root root 4096 Aug 14 21:05 .
dr-xr-xr-x. 18 root root 4096 Aug 14 21:05 ..

コンテナ内にはカーネルモジュールはすっからかん

結論

CentOS7 for Docker Containerではコンテナに対してiSCSIイニシエータを導入することは出来ない。
これはCentOS7上で利用するDockerコンテナの制約である。

参考

[RedHat社森若氏の資料](14P)でもDocker Containerはカーネルやハードウェアに対して操作できないことを示唆

8
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
7