Docker Community Forums

Share and learn in the Docker community.

Docker container not seeing the hugepages mount directory


(Syreddy) #1

I have created 1G hugepages by providing boot params in Grub.
After booting created a mount point for hugepages as below.

mkdir -p /mnt/hugepages
mount -t hugetlbfs -o pagesize=1G node /mnt/hugepages

In the host I am able to see the mount,

[root@xxxxx ~]# cat /proc/mounts | grep huge
cgroup /sys/fs/cgroup/hugetlb cgroup rw,seclabel,nosuid,nodev,noexec,relatime,hugetlb 0 0
node /mnt/hugepages hugetlbfs rw,seclabel,relatime,pagesize=1G 0 0

But I dont see the mount in docker container

[root@xxxx ~]# docker run busybox cat /proc/mounts | grep huge
cgroup /sys/fs/cgroup/hugetlb cgroup ro,seclabel,nosuid,nodev,noexec,relatime,hugetlb 0 0
[root@xxxx ~]#

Also tried the same in previleged mode
[root@xxxx ~]# docker run --privileged busybox cat /proc/mounts | grep huge
cgroup /sys/fs/cgroup/hugetlb cgroup rw,seclabel,nosuid,nodev,noexec,relatime,hugetlb 0 0
[root@xxxx ~]#


(Singhrohit487) #2

Hi @syreddy,

If you have configured HugeTlbPage on the your host system, so please make sure that it is mounted under /dev/hugepages directory and then give your container access to it by mapping the mount point to /dev/hugepages on the container.

You can bind mount a volume using -v option or --device to add a host device to the container. You’ll have docker run command like this:

docker run -v /dev/hugepages:/dev/hugepages …

OR

docker run --device=/dev/hugepages:/dev/hugepages …

Thanks,


(Syreddy) #3

Thanks @singhrohit487 its working