Does docker guest mount harddisk device to a file and not a directory?












0















I have run the following docker command to create an instance of an Ubuntu image...



docker run -it ubuntu bash


when I issue a mount command I see the following...



root@ca13e87462b5:/# mount
overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/O253SM3ZGX5EFP7OSBPPU5UW2C:/var/lib/docker/overlay2/l/IZEDWP7V4P4JWPLEL4EMN6GA5V:/var/lib/docker/overlay2/l/ZMFQPLBLMSGQYI7LDX5FSBHLEY:/var/lib/docker/overlay2/l/AVPGKJLG4AQJZLP3PKPGWQOMK6:/var/lib/docker/overlay2/l/6AFZ5ARHQ3PKYRWFQPUULZIMHB,upperdir=/var/lib/docker/overlay2/5a86c70a335f15d9c93bfb440b63b64aaef2b03b35ea42e3cef3609f96075514/diff,workdir=/var/lib/docker/overlay2/5a86c70a335f15d9c93bfb440b63b64aaef2b03b35ea42e3cef3609f96075514/work)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,relatime,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (ro,nosuid,nodev,noexec,relatime,xattr,name=systemd)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/rdma type cgroup (ro,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (ro,nosuid,nodev,noexec,relatime,hugetlb)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
/dev/sdb2 on /etc/resolv.conf type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/sdb2 on /etc/hostname type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/sdb2 on /etc/hosts type ext4 (rw,relatime,errors=remount-ro,data=ordered)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
devpts on /dev/console type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
proc on /proc/bus type proc (ro,relatime)
proc on /proc/fs type proc (ro,relatime)
proc on /proc/irq type proc (ro,relatime)
proc on /proc/sys type proc (ro,relatime)
proc on /proc/sysrq-trigger type proc (ro,relatime)
tmpfs on /proc/asound type tmpfs (ro,relatime)
tmpfs on /proc/acpi type tmpfs (ro,relatime)
tmpfs on /proc/kcore type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/keys type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/sched_debug type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/scsi type tmpfs (ro,relatime)
tmpfs on /sys/firmware type tmpfs (ro,relatime)


So I issue a disk free command...



root@ca13e87462b5:/# df -h
Filesystem Size Used Avail Use% Mounted on
overlay 219G 162G 46G 79% /
tmpfs 64M 0 64M 0% /dev
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
/dev/sdb2 219G 162G 46G 79% /etc/hosts
shm 64M 0 64M 0% /dev/shm
tmpfs 7.9G 0 7.9G 0% /proc/asound
tmpfs 7.9G 0 7.9G 0% /proc/acpi
tmpfs 7.9G 0 7.9G 0% /proc/scsi
tmpfs 7.9G 0 7.9G 0% /sys/firmware


It seems to me the mount point for device /dev/sdb2 is a file - /etc/hosts.



I wasn't aware that I could mount a device to a file. I am misunderstanding what is happening here?



If I perform an ls on /etc I see hosts is a file...



root@ca13e87462b5:/# ls -al /etc
total 268
drwxr-xr-x 1 root root 4096 Feb 24 17:40 .
drwxr-xr-x 1 root root 4096 Feb 24 17:40 ..
-rw------- 1 root root 0 Feb 4 21:03 .pwd.lock
-rw-r--r-- 1 root root 3028 Feb 4 21:03 adduser.conf
drwxr-xr-x 2 root root 4096 Feb 4 21:04 alternatives
drwxr-xr-x 1 root root 4096 Feb 4 21:03 apt
-rw-r--r-- 1 root root 2319 Apr 4 2018 bash.bashrc
-rw-r--r-- 1 root root 367 Jan 27 2016 bindresvport.blacklist
drwxr-xr-x 2 root root 4096 Feb 4 21:04 cron.daily
-rw-r--r-- 1 root root 2969 Feb 28 2018 debconf.conf
-rw-r--r-- 1 root root 11 Jun 25 2017 debian_version
drwxr-xr-x 2 root root 4096 Feb 4 21:04 default
-rw-r--r-- 1 root root 604 Aug 13 2017 deluser.conf
drwxr-xr-x 1 root root 4096 Feb 4 21:04 dpkg
-rw-r--r-- 1 root root 96 Feb 4 21:03 environment
-rw-r--r-- 1 root root 37 Feb 4 21:02 fstab
-rw-r--r-- 1 root root 2584 Feb 1 2018 gai.conf
-rw-r--r-- 1 root root 446 Feb 4 21:03 group
-rw-r----- 1 root shadow 374 Feb 4 21:03 gshadow
-rw-r--r-- 1 root root 92 Apr 9 2018 host.conf
-rw-r--r-- 1 root root 13 Feb 24 17:40 hostname
-rw-r--r-- 1 root root 174 Feb 24 17:40 hosts
drwxr-xr-x 2 root root 4096 Feb 4 21:04 init.d
-rw-r--r-- 1 root root 26 Aug 19 2018 issue
-rw-r--r-- 1 root root 19 Aug 19 2018 issue.net
drwxr-xr-x 3 root root 4096 Feb 4 21:03 kernel
-rw-r--r-- 1 root root 7274 Feb 4 21:04 ld.so.cache
-rw-r--r-- 1 root root 34 Jan 27 2016 ld.so.conf
drwxr-xr-x 2 root root 4096 Feb 4 21:04 ld.so.conf.d
-rw-r--r-- 1 root root 267 Apr 9 2018 legal
-rw-r--r-- 1 root root 191 Feb 7 2018 libaudit.conf
-rw-r--r-- 1 root root 10550 Jan 25 2018 login.defs
drwxr-xr-x 2 root root 4096 Feb 4 21:04 logrotate.d
-rw-r--r-- 1 root root 105 Aug 19 2018 lsb-release
-rw-r--r-- 1 root root 0 Feb 4 21:04 machine-id
-rw-r--r-- 1 root root 812 Mar 24 2018 mke2fs.conf
lrwxrwxrwx 1 root root 12 Feb 24 17:40 mtab -> /proc/mounts
-rw-r--r-- 1 root root 91 Apr 9 2018 networks
-rw-r--r-- 1 root root 497 Oct 5 2016 nsswitch.conf
drwxr-xr-x 2 root root 4096 Feb 4 21:02 opt
lrwxrwxrwx 1 root root 21 Aug 19 2018 os-release -> ../usr/lib/os-release
-rw-r--r-- 1 root root 552 Apr 4 2018 pam.conf
drwxr-xr-x 2 root root 4096 Feb 4 21:04 pam.d
-rw-r--r-- 1 root root 926 Feb 4 21:03 passwd
-rw-r--r-- 1 root root 581 Apr 9 2018 profile
drwxr-xr-x 2 root root 4096 Feb 4 21:04 profile.d
drwxr-xr-x 2 root root 4096 Oct 25 2017 rc0.d
drwxr-xr-x 2 root root 4096 Oct 25 2017 rc1.d
drwxr-xr-x 2 root root 4096 Oct 25 2017 rc2.d
drwxr-xr-x 2 root root 4096 Oct 25 2017 rc3.d
drwxr-xr-x 2 root root 4096 Oct 25 2017 rc4.d
drwxr-xr-x 2 root root 4096 Oct 25 2017 rc5.d
drwxr-xr-x 2 root root 4096 Oct 25 2017 rc6.d
drwxr-xr-x 2 root root 4096 Feb 4 21:03 rcS.d
-rw-r--r-- 1 root root 628 Feb 24 17:40 resolv.conf
-rwxr-xr-x 1 root root 268 Jul 21 2017 rmt
-rw-r--r-- 1 root root 4141 Jan 25 2018 securetty
drwxr-xr-x 4 root root 4096 Feb 4 21:03 security
drwxr-xr-x 2 root root 4096 Feb 4 21:04 selinux
-rw-r----- 1 root shadow 501 Feb 4 21:03 shadow
-rw-r--r-- 1 root root 73 Feb 4 21:03 shells
drwxr-xr-x 2 root root 4096 Feb 4 21:03 skel
-rw-r--r-- 1 root root 0 Feb 4 21:03 subgid
-rw-r--r-- 1 root root 0 Feb 4 21:03 subuid
-rw-r--r-- 1 root root 2683 Jan 17 2018 sysctl.conf
drwxr-xr-x 2 root root 4096 Feb 4 21:04 sysctl.d
drwxr-xr-x 3 root root 4096 Oct 25 2017 systemd
drwxr-xr-x 2 root root 4096 Feb 4 21:04 terminfo
drwxr-xr-x 2 root root 4096 Feb 4 21:04 update-motd.d









share|improve this question



























    0















    I have run the following docker command to create an instance of an Ubuntu image...



    docker run -it ubuntu bash


    when I issue a mount command I see the following...



    root@ca13e87462b5:/# mount
    overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/O253SM3ZGX5EFP7OSBPPU5UW2C:/var/lib/docker/overlay2/l/IZEDWP7V4P4JWPLEL4EMN6GA5V:/var/lib/docker/overlay2/l/ZMFQPLBLMSGQYI7LDX5FSBHLEY:/var/lib/docker/overlay2/l/AVPGKJLG4AQJZLP3PKPGWQOMK6:/var/lib/docker/overlay2/l/6AFZ5ARHQ3PKYRWFQPUULZIMHB,upperdir=/var/lib/docker/overlay2/5a86c70a335f15d9c93bfb440b63b64aaef2b03b35ea42e3cef3609f96075514/diff,workdir=/var/lib/docker/overlay2/5a86c70a335f15d9c93bfb440b63b64aaef2b03b35ea42e3cef3609f96075514/work)
    proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
    tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755)
    devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
    sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
    tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,relatime,mode=755)
    cgroup on /sys/fs/cgroup/systemd type cgroup (ro,nosuid,nodev,noexec,relatime,xattr,name=systemd)
    cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls,net_prio)
    cgroup on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event)
    cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpu,cpuacct)
    cgroup on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids)
    cgroup on /sys/fs/cgroup/rdma type cgroup (ro,nosuid,nodev,noexec,relatime,rdma)
    cgroup on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio)
    cgroup on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset)
    cgroup on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer)
    cgroup on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices)
    cgroup on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory)
    cgroup on /sys/fs/cgroup/hugetlb type cgroup (ro,nosuid,nodev,noexec,relatime,hugetlb)
    mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
    /dev/sdb2 on /etc/resolv.conf type ext4 (rw,relatime,errors=remount-ro,data=ordered)
    /dev/sdb2 on /etc/hostname type ext4 (rw,relatime,errors=remount-ro,data=ordered)
    /dev/sdb2 on /etc/hosts type ext4 (rw,relatime,errors=remount-ro,data=ordered)
    shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
    devpts on /dev/console type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
    proc on /proc/bus type proc (ro,relatime)
    proc on /proc/fs type proc (ro,relatime)
    proc on /proc/irq type proc (ro,relatime)
    proc on /proc/sys type proc (ro,relatime)
    proc on /proc/sysrq-trigger type proc (ro,relatime)
    tmpfs on /proc/asound type tmpfs (ro,relatime)
    tmpfs on /proc/acpi type tmpfs (ro,relatime)
    tmpfs on /proc/kcore type tmpfs (rw,nosuid,size=65536k,mode=755)
    tmpfs on /proc/keys type tmpfs (rw,nosuid,size=65536k,mode=755)
    tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755)
    tmpfs on /proc/sched_debug type tmpfs (rw,nosuid,size=65536k,mode=755)
    tmpfs on /proc/scsi type tmpfs (ro,relatime)
    tmpfs on /sys/firmware type tmpfs (ro,relatime)


    So I issue a disk free command...



    root@ca13e87462b5:/# df -h
    Filesystem Size Used Avail Use% Mounted on
    overlay 219G 162G 46G 79% /
    tmpfs 64M 0 64M 0% /dev
    tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
    /dev/sdb2 219G 162G 46G 79% /etc/hosts
    shm 64M 0 64M 0% /dev/shm
    tmpfs 7.9G 0 7.9G 0% /proc/asound
    tmpfs 7.9G 0 7.9G 0% /proc/acpi
    tmpfs 7.9G 0 7.9G 0% /proc/scsi
    tmpfs 7.9G 0 7.9G 0% /sys/firmware


    It seems to me the mount point for device /dev/sdb2 is a file - /etc/hosts.



    I wasn't aware that I could mount a device to a file. I am misunderstanding what is happening here?



    If I perform an ls on /etc I see hosts is a file...



    root@ca13e87462b5:/# ls -al /etc
    total 268
    drwxr-xr-x 1 root root 4096 Feb 24 17:40 .
    drwxr-xr-x 1 root root 4096 Feb 24 17:40 ..
    -rw------- 1 root root 0 Feb 4 21:03 .pwd.lock
    -rw-r--r-- 1 root root 3028 Feb 4 21:03 adduser.conf
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 alternatives
    drwxr-xr-x 1 root root 4096 Feb 4 21:03 apt
    -rw-r--r-- 1 root root 2319 Apr 4 2018 bash.bashrc
    -rw-r--r-- 1 root root 367 Jan 27 2016 bindresvport.blacklist
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 cron.daily
    -rw-r--r-- 1 root root 2969 Feb 28 2018 debconf.conf
    -rw-r--r-- 1 root root 11 Jun 25 2017 debian_version
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 default
    -rw-r--r-- 1 root root 604 Aug 13 2017 deluser.conf
    drwxr-xr-x 1 root root 4096 Feb 4 21:04 dpkg
    -rw-r--r-- 1 root root 96 Feb 4 21:03 environment
    -rw-r--r-- 1 root root 37 Feb 4 21:02 fstab
    -rw-r--r-- 1 root root 2584 Feb 1 2018 gai.conf
    -rw-r--r-- 1 root root 446 Feb 4 21:03 group
    -rw-r----- 1 root shadow 374 Feb 4 21:03 gshadow
    -rw-r--r-- 1 root root 92 Apr 9 2018 host.conf
    -rw-r--r-- 1 root root 13 Feb 24 17:40 hostname
    -rw-r--r-- 1 root root 174 Feb 24 17:40 hosts
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 init.d
    -rw-r--r-- 1 root root 26 Aug 19 2018 issue
    -rw-r--r-- 1 root root 19 Aug 19 2018 issue.net
    drwxr-xr-x 3 root root 4096 Feb 4 21:03 kernel
    -rw-r--r-- 1 root root 7274 Feb 4 21:04 ld.so.cache
    -rw-r--r-- 1 root root 34 Jan 27 2016 ld.so.conf
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 ld.so.conf.d
    -rw-r--r-- 1 root root 267 Apr 9 2018 legal
    -rw-r--r-- 1 root root 191 Feb 7 2018 libaudit.conf
    -rw-r--r-- 1 root root 10550 Jan 25 2018 login.defs
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 logrotate.d
    -rw-r--r-- 1 root root 105 Aug 19 2018 lsb-release
    -rw-r--r-- 1 root root 0 Feb 4 21:04 machine-id
    -rw-r--r-- 1 root root 812 Mar 24 2018 mke2fs.conf
    lrwxrwxrwx 1 root root 12 Feb 24 17:40 mtab -> /proc/mounts
    -rw-r--r-- 1 root root 91 Apr 9 2018 networks
    -rw-r--r-- 1 root root 497 Oct 5 2016 nsswitch.conf
    drwxr-xr-x 2 root root 4096 Feb 4 21:02 opt
    lrwxrwxrwx 1 root root 21 Aug 19 2018 os-release -> ../usr/lib/os-release
    -rw-r--r-- 1 root root 552 Apr 4 2018 pam.conf
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 pam.d
    -rw-r--r-- 1 root root 926 Feb 4 21:03 passwd
    -rw-r--r-- 1 root root 581 Apr 9 2018 profile
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 profile.d
    drwxr-xr-x 2 root root 4096 Oct 25 2017 rc0.d
    drwxr-xr-x 2 root root 4096 Oct 25 2017 rc1.d
    drwxr-xr-x 2 root root 4096 Oct 25 2017 rc2.d
    drwxr-xr-x 2 root root 4096 Oct 25 2017 rc3.d
    drwxr-xr-x 2 root root 4096 Oct 25 2017 rc4.d
    drwxr-xr-x 2 root root 4096 Oct 25 2017 rc5.d
    drwxr-xr-x 2 root root 4096 Oct 25 2017 rc6.d
    drwxr-xr-x 2 root root 4096 Feb 4 21:03 rcS.d
    -rw-r--r-- 1 root root 628 Feb 24 17:40 resolv.conf
    -rwxr-xr-x 1 root root 268 Jul 21 2017 rmt
    -rw-r--r-- 1 root root 4141 Jan 25 2018 securetty
    drwxr-xr-x 4 root root 4096 Feb 4 21:03 security
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 selinux
    -rw-r----- 1 root shadow 501 Feb 4 21:03 shadow
    -rw-r--r-- 1 root root 73 Feb 4 21:03 shells
    drwxr-xr-x 2 root root 4096 Feb 4 21:03 skel
    -rw-r--r-- 1 root root 0 Feb 4 21:03 subgid
    -rw-r--r-- 1 root root 0 Feb 4 21:03 subuid
    -rw-r--r-- 1 root root 2683 Jan 17 2018 sysctl.conf
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 sysctl.d
    drwxr-xr-x 3 root root 4096 Oct 25 2017 systemd
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 terminfo
    drwxr-xr-x 2 root root 4096 Feb 4 21:04 update-motd.d









    share|improve this question

























      0












      0








      0








      I have run the following docker command to create an instance of an Ubuntu image...



      docker run -it ubuntu bash


      when I issue a mount command I see the following...



      root@ca13e87462b5:/# mount
      overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/O253SM3ZGX5EFP7OSBPPU5UW2C:/var/lib/docker/overlay2/l/IZEDWP7V4P4JWPLEL4EMN6GA5V:/var/lib/docker/overlay2/l/ZMFQPLBLMSGQYI7LDX5FSBHLEY:/var/lib/docker/overlay2/l/AVPGKJLG4AQJZLP3PKPGWQOMK6:/var/lib/docker/overlay2/l/6AFZ5ARHQ3PKYRWFQPUULZIMHB,upperdir=/var/lib/docker/overlay2/5a86c70a335f15d9c93bfb440b63b64aaef2b03b35ea42e3cef3609f96075514/diff,workdir=/var/lib/docker/overlay2/5a86c70a335f15d9c93bfb440b63b64aaef2b03b35ea42e3cef3609f96075514/work)
      proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
      tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755)
      devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
      sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
      tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,relatime,mode=755)
      cgroup on /sys/fs/cgroup/systemd type cgroup (ro,nosuid,nodev,noexec,relatime,xattr,name=systemd)
      cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls,net_prio)
      cgroup on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event)
      cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpu,cpuacct)
      cgroup on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids)
      cgroup on /sys/fs/cgroup/rdma type cgroup (ro,nosuid,nodev,noexec,relatime,rdma)
      cgroup on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio)
      cgroup on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset)
      cgroup on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer)
      cgroup on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices)
      cgroup on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory)
      cgroup on /sys/fs/cgroup/hugetlb type cgroup (ro,nosuid,nodev,noexec,relatime,hugetlb)
      mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
      /dev/sdb2 on /etc/resolv.conf type ext4 (rw,relatime,errors=remount-ro,data=ordered)
      /dev/sdb2 on /etc/hostname type ext4 (rw,relatime,errors=remount-ro,data=ordered)
      /dev/sdb2 on /etc/hosts type ext4 (rw,relatime,errors=remount-ro,data=ordered)
      shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
      devpts on /dev/console type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
      proc on /proc/bus type proc (ro,relatime)
      proc on /proc/fs type proc (ro,relatime)
      proc on /proc/irq type proc (ro,relatime)
      proc on /proc/sys type proc (ro,relatime)
      proc on /proc/sysrq-trigger type proc (ro,relatime)
      tmpfs on /proc/asound type tmpfs (ro,relatime)
      tmpfs on /proc/acpi type tmpfs (ro,relatime)
      tmpfs on /proc/kcore type tmpfs (rw,nosuid,size=65536k,mode=755)
      tmpfs on /proc/keys type tmpfs (rw,nosuid,size=65536k,mode=755)
      tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755)
      tmpfs on /proc/sched_debug type tmpfs (rw,nosuid,size=65536k,mode=755)
      tmpfs on /proc/scsi type tmpfs (ro,relatime)
      tmpfs on /sys/firmware type tmpfs (ro,relatime)


      So I issue a disk free command...



      root@ca13e87462b5:/# df -h
      Filesystem Size Used Avail Use% Mounted on
      overlay 219G 162G 46G 79% /
      tmpfs 64M 0 64M 0% /dev
      tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
      /dev/sdb2 219G 162G 46G 79% /etc/hosts
      shm 64M 0 64M 0% /dev/shm
      tmpfs 7.9G 0 7.9G 0% /proc/asound
      tmpfs 7.9G 0 7.9G 0% /proc/acpi
      tmpfs 7.9G 0 7.9G 0% /proc/scsi
      tmpfs 7.9G 0 7.9G 0% /sys/firmware


      It seems to me the mount point for device /dev/sdb2 is a file - /etc/hosts.



      I wasn't aware that I could mount a device to a file. I am misunderstanding what is happening here?



      If I perform an ls on /etc I see hosts is a file...



      root@ca13e87462b5:/# ls -al /etc
      total 268
      drwxr-xr-x 1 root root 4096 Feb 24 17:40 .
      drwxr-xr-x 1 root root 4096 Feb 24 17:40 ..
      -rw------- 1 root root 0 Feb 4 21:03 .pwd.lock
      -rw-r--r-- 1 root root 3028 Feb 4 21:03 adduser.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 alternatives
      drwxr-xr-x 1 root root 4096 Feb 4 21:03 apt
      -rw-r--r-- 1 root root 2319 Apr 4 2018 bash.bashrc
      -rw-r--r-- 1 root root 367 Jan 27 2016 bindresvport.blacklist
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 cron.daily
      -rw-r--r-- 1 root root 2969 Feb 28 2018 debconf.conf
      -rw-r--r-- 1 root root 11 Jun 25 2017 debian_version
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 default
      -rw-r--r-- 1 root root 604 Aug 13 2017 deluser.conf
      drwxr-xr-x 1 root root 4096 Feb 4 21:04 dpkg
      -rw-r--r-- 1 root root 96 Feb 4 21:03 environment
      -rw-r--r-- 1 root root 37 Feb 4 21:02 fstab
      -rw-r--r-- 1 root root 2584 Feb 1 2018 gai.conf
      -rw-r--r-- 1 root root 446 Feb 4 21:03 group
      -rw-r----- 1 root shadow 374 Feb 4 21:03 gshadow
      -rw-r--r-- 1 root root 92 Apr 9 2018 host.conf
      -rw-r--r-- 1 root root 13 Feb 24 17:40 hostname
      -rw-r--r-- 1 root root 174 Feb 24 17:40 hosts
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 init.d
      -rw-r--r-- 1 root root 26 Aug 19 2018 issue
      -rw-r--r-- 1 root root 19 Aug 19 2018 issue.net
      drwxr-xr-x 3 root root 4096 Feb 4 21:03 kernel
      -rw-r--r-- 1 root root 7274 Feb 4 21:04 ld.so.cache
      -rw-r--r-- 1 root root 34 Jan 27 2016 ld.so.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 ld.so.conf.d
      -rw-r--r-- 1 root root 267 Apr 9 2018 legal
      -rw-r--r-- 1 root root 191 Feb 7 2018 libaudit.conf
      -rw-r--r-- 1 root root 10550 Jan 25 2018 login.defs
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 logrotate.d
      -rw-r--r-- 1 root root 105 Aug 19 2018 lsb-release
      -rw-r--r-- 1 root root 0 Feb 4 21:04 machine-id
      -rw-r--r-- 1 root root 812 Mar 24 2018 mke2fs.conf
      lrwxrwxrwx 1 root root 12 Feb 24 17:40 mtab -> /proc/mounts
      -rw-r--r-- 1 root root 91 Apr 9 2018 networks
      -rw-r--r-- 1 root root 497 Oct 5 2016 nsswitch.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:02 opt
      lrwxrwxrwx 1 root root 21 Aug 19 2018 os-release -> ../usr/lib/os-release
      -rw-r--r-- 1 root root 552 Apr 4 2018 pam.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 pam.d
      -rw-r--r-- 1 root root 926 Feb 4 21:03 passwd
      -rw-r--r-- 1 root root 581 Apr 9 2018 profile
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 profile.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc0.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc1.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc2.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc3.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc4.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc5.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc6.d
      drwxr-xr-x 2 root root 4096 Feb 4 21:03 rcS.d
      -rw-r--r-- 1 root root 628 Feb 24 17:40 resolv.conf
      -rwxr-xr-x 1 root root 268 Jul 21 2017 rmt
      -rw-r--r-- 1 root root 4141 Jan 25 2018 securetty
      drwxr-xr-x 4 root root 4096 Feb 4 21:03 security
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 selinux
      -rw-r----- 1 root shadow 501 Feb 4 21:03 shadow
      -rw-r--r-- 1 root root 73 Feb 4 21:03 shells
      drwxr-xr-x 2 root root 4096 Feb 4 21:03 skel
      -rw-r--r-- 1 root root 0 Feb 4 21:03 subgid
      -rw-r--r-- 1 root root 0 Feb 4 21:03 subuid
      -rw-r--r-- 1 root root 2683 Jan 17 2018 sysctl.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 sysctl.d
      drwxr-xr-x 3 root root 4096 Oct 25 2017 systemd
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 terminfo
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 update-motd.d









      share|improve this question














      I have run the following docker command to create an instance of an Ubuntu image...



      docker run -it ubuntu bash


      when I issue a mount command I see the following...



      root@ca13e87462b5:/# mount
      overlay on / type overlay (rw,relatime,lowerdir=/var/lib/docker/overlay2/l/O253SM3ZGX5EFP7OSBPPU5UW2C:/var/lib/docker/overlay2/l/IZEDWP7V4P4JWPLEL4EMN6GA5V:/var/lib/docker/overlay2/l/ZMFQPLBLMSGQYI7LDX5FSBHLEY:/var/lib/docker/overlay2/l/AVPGKJLG4AQJZLP3PKPGWQOMK6:/var/lib/docker/overlay2/l/6AFZ5ARHQ3PKYRWFQPUULZIMHB,upperdir=/var/lib/docker/overlay2/5a86c70a335f15d9c93bfb440b63b64aaef2b03b35ea42e3cef3609f96075514/diff,workdir=/var/lib/docker/overlay2/5a86c70a335f15d9c93bfb440b63b64aaef2b03b35ea42e3cef3609f96075514/work)
      proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
      tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755)
      devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
      sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
      tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,relatime,mode=755)
      cgroup on /sys/fs/cgroup/systemd type cgroup (ro,nosuid,nodev,noexec,relatime,xattr,name=systemd)
      cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls,net_prio)
      cgroup on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event)
      cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpu,cpuacct)
      cgroup on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids)
      cgroup on /sys/fs/cgroup/rdma type cgroup (ro,nosuid,nodev,noexec,relatime,rdma)
      cgroup on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio)
      cgroup on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset)
      cgroup on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer)
      cgroup on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices)
      cgroup on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory)
      cgroup on /sys/fs/cgroup/hugetlb type cgroup (ro,nosuid,nodev,noexec,relatime,hugetlb)
      mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
      /dev/sdb2 on /etc/resolv.conf type ext4 (rw,relatime,errors=remount-ro,data=ordered)
      /dev/sdb2 on /etc/hostname type ext4 (rw,relatime,errors=remount-ro,data=ordered)
      /dev/sdb2 on /etc/hosts type ext4 (rw,relatime,errors=remount-ro,data=ordered)
      shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
      devpts on /dev/console type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
      proc on /proc/bus type proc (ro,relatime)
      proc on /proc/fs type proc (ro,relatime)
      proc on /proc/irq type proc (ro,relatime)
      proc on /proc/sys type proc (ro,relatime)
      proc on /proc/sysrq-trigger type proc (ro,relatime)
      tmpfs on /proc/asound type tmpfs (ro,relatime)
      tmpfs on /proc/acpi type tmpfs (ro,relatime)
      tmpfs on /proc/kcore type tmpfs (rw,nosuid,size=65536k,mode=755)
      tmpfs on /proc/keys type tmpfs (rw,nosuid,size=65536k,mode=755)
      tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755)
      tmpfs on /proc/sched_debug type tmpfs (rw,nosuid,size=65536k,mode=755)
      tmpfs on /proc/scsi type tmpfs (ro,relatime)
      tmpfs on /sys/firmware type tmpfs (ro,relatime)


      So I issue a disk free command...



      root@ca13e87462b5:/# df -h
      Filesystem Size Used Avail Use% Mounted on
      overlay 219G 162G 46G 79% /
      tmpfs 64M 0 64M 0% /dev
      tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
      /dev/sdb2 219G 162G 46G 79% /etc/hosts
      shm 64M 0 64M 0% /dev/shm
      tmpfs 7.9G 0 7.9G 0% /proc/asound
      tmpfs 7.9G 0 7.9G 0% /proc/acpi
      tmpfs 7.9G 0 7.9G 0% /proc/scsi
      tmpfs 7.9G 0 7.9G 0% /sys/firmware


      It seems to me the mount point for device /dev/sdb2 is a file - /etc/hosts.



      I wasn't aware that I could mount a device to a file. I am misunderstanding what is happening here?



      If I perform an ls on /etc I see hosts is a file...



      root@ca13e87462b5:/# ls -al /etc
      total 268
      drwxr-xr-x 1 root root 4096 Feb 24 17:40 .
      drwxr-xr-x 1 root root 4096 Feb 24 17:40 ..
      -rw------- 1 root root 0 Feb 4 21:03 .pwd.lock
      -rw-r--r-- 1 root root 3028 Feb 4 21:03 adduser.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 alternatives
      drwxr-xr-x 1 root root 4096 Feb 4 21:03 apt
      -rw-r--r-- 1 root root 2319 Apr 4 2018 bash.bashrc
      -rw-r--r-- 1 root root 367 Jan 27 2016 bindresvport.blacklist
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 cron.daily
      -rw-r--r-- 1 root root 2969 Feb 28 2018 debconf.conf
      -rw-r--r-- 1 root root 11 Jun 25 2017 debian_version
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 default
      -rw-r--r-- 1 root root 604 Aug 13 2017 deluser.conf
      drwxr-xr-x 1 root root 4096 Feb 4 21:04 dpkg
      -rw-r--r-- 1 root root 96 Feb 4 21:03 environment
      -rw-r--r-- 1 root root 37 Feb 4 21:02 fstab
      -rw-r--r-- 1 root root 2584 Feb 1 2018 gai.conf
      -rw-r--r-- 1 root root 446 Feb 4 21:03 group
      -rw-r----- 1 root shadow 374 Feb 4 21:03 gshadow
      -rw-r--r-- 1 root root 92 Apr 9 2018 host.conf
      -rw-r--r-- 1 root root 13 Feb 24 17:40 hostname
      -rw-r--r-- 1 root root 174 Feb 24 17:40 hosts
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 init.d
      -rw-r--r-- 1 root root 26 Aug 19 2018 issue
      -rw-r--r-- 1 root root 19 Aug 19 2018 issue.net
      drwxr-xr-x 3 root root 4096 Feb 4 21:03 kernel
      -rw-r--r-- 1 root root 7274 Feb 4 21:04 ld.so.cache
      -rw-r--r-- 1 root root 34 Jan 27 2016 ld.so.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 ld.so.conf.d
      -rw-r--r-- 1 root root 267 Apr 9 2018 legal
      -rw-r--r-- 1 root root 191 Feb 7 2018 libaudit.conf
      -rw-r--r-- 1 root root 10550 Jan 25 2018 login.defs
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 logrotate.d
      -rw-r--r-- 1 root root 105 Aug 19 2018 lsb-release
      -rw-r--r-- 1 root root 0 Feb 4 21:04 machine-id
      -rw-r--r-- 1 root root 812 Mar 24 2018 mke2fs.conf
      lrwxrwxrwx 1 root root 12 Feb 24 17:40 mtab -> /proc/mounts
      -rw-r--r-- 1 root root 91 Apr 9 2018 networks
      -rw-r--r-- 1 root root 497 Oct 5 2016 nsswitch.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:02 opt
      lrwxrwxrwx 1 root root 21 Aug 19 2018 os-release -> ../usr/lib/os-release
      -rw-r--r-- 1 root root 552 Apr 4 2018 pam.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 pam.d
      -rw-r--r-- 1 root root 926 Feb 4 21:03 passwd
      -rw-r--r-- 1 root root 581 Apr 9 2018 profile
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 profile.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc0.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc1.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc2.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc3.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc4.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc5.d
      drwxr-xr-x 2 root root 4096 Oct 25 2017 rc6.d
      drwxr-xr-x 2 root root 4096 Feb 4 21:03 rcS.d
      -rw-r--r-- 1 root root 628 Feb 24 17:40 resolv.conf
      -rwxr-xr-x 1 root root 268 Jul 21 2017 rmt
      -rw-r--r-- 1 root root 4141 Jan 25 2018 securetty
      drwxr-xr-x 4 root root 4096 Feb 4 21:03 security
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 selinux
      -rw-r----- 1 root shadow 501 Feb 4 21:03 shadow
      -rw-r--r-- 1 root root 73 Feb 4 21:03 shells
      drwxr-xr-x 2 root root 4096 Feb 4 21:03 skel
      -rw-r--r-- 1 root root 0 Feb 4 21:03 subgid
      -rw-r--r-- 1 root root 0 Feb 4 21:03 subuid
      -rw-r--r-- 1 root root 2683 Jan 17 2018 sysctl.conf
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 sysctl.d
      drwxr-xr-x 3 root root 4096 Oct 25 2017 systemd
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 terminfo
      drwxr-xr-x 2 root root 4096 Feb 4 21:04 update-motd.d






      ubuntu docker






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 24 at 17:43









      barrypickerbarrypicker

      1053




      1053






















          1 Answer
          1






          active

          oldest

          votes


















          2














          No. Docker is bind mounting a file on a file.



          From man 8 mount:




          Bind mounts



          Remount part of the file hierarchy somewhere else. The call is:



            mount --bind olddir newdir


          ...



          One can also remount a single file (on a single file)




          The reason why it looks like Docker is mounting a device on a file is that the mount -l command's output is incomplete: It does not show the source-path of the bind mount.



          Again from man 8 mount:




          Listing the mounts



          The listing mode is maintained for backward compatibility only.



          For more robust and customizable output use findmnt(8)




          Run findmnt and you'll see the source of the bind mounts (in the form of device[source-path]).






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502730%2fdoes-docker-guest-mount-harddisk-device-to-a-file-and-not-a-directory%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            No. Docker is bind mounting a file on a file.



            From man 8 mount:




            Bind mounts



            Remount part of the file hierarchy somewhere else. The call is:



              mount --bind olddir newdir


            ...



            One can also remount a single file (on a single file)




            The reason why it looks like Docker is mounting a device on a file is that the mount -l command's output is incomplete: It does not show the source-path of the bind mount.



            Again from man 8 mount:




            Listing the mounts



            The listing mode is maintained for backward compatibility only.



            For more robust and customizable output use findmnt(8)




            Run findmnt and you'll see the source of the bind mounts (in the form of device[source-path]).






            share|improve this answer




























              2














              No. Docker is bind mounting a file on a file.



              From man 8 mount:




              Bind mounts



              Remount part of the file hierarchy somewhere else. The call is:



                mount --bind olddir newdir


              ...



              One can also remount a single file (on a single file)




              The reason why it looks like Docker is mounting a device on a file is that the mount -l command's output is incomplete: It does not show the source-path of the bind mount.



              Again from man 8 mount:




              Listing the mounts



              The listing mode is maintained for backward compatibility only.



              For more robust and customizable output use findmnt(8)




              Run findmnt and you'll see the source of the bind mounts (in the form of device[source-path]).






              share|improve this answer


























                2












                2








                2







                No. Docker is bind mounting a file on a file.



                From man 8 mount:




                Bind mounts



                Remount part of the file hierarchy somewhere else. The call is:



                  mount --bind olddir newdir


                ...



                One can also remount a single file (on a single file)




                The reason why it looks like Docker is mounting a device on a file is that the mount -l command's output is incomplete: It does not show the source-path of the bind mount.



                Again from man 8 mount:




                Listing the mounts



                The listing mode is maintained for backward compatibility only.



                For more robust and customizable output use findmnt(8)




                Run findmnt and you'll see the source of the bind mounts (in the form of device[source-path]).






                share|improve this answer













                No. Docker is bind mounting a file on a file.



                From man 8 mount:




                Bind mounts



                Remount part of the file hierarchy somewhere else. The call is:



                  mount --bind olddir newdir


                ...



                One can also remount a single file (on a single file)




                The reason why it looks like Docker is mounting a device on a file is that the mount -l command's output is incomplete: It does not show the source-path of the bind mount.



                Again from man 8 mount:




                Listing the mounts



                The listing mode is maintained for backward compatibility only.



                For more robust and customizable output use findmnt(8)




                Run findmnt and you'll see the source of the bind mounts (in the form of device[source-path]).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 25 at 6:16









                catanmancatanman

                9612




                9612






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f502730%2fdoes-docker-guest-mount-harddisk-device-to-a-file-and-not-a-directory%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                    is 'sed' thread safe

                    How to make a Squid Proxy server?