fdisk doesn't find loop device in docker

Having a somewhat odd problem. I am testing out an installation on Docker that needs a free block device, here are the steps I took:

  • Mounted an image file as /dev/loop4 on the host
  • Wrote a label to it and created a partition: /dev/loop4p1 (this is for testing only, what I need is the raw device)
  • Launched a Docker container (ubuntu:14.04) in privileged mode

Now, using the device/partition works fine: I can mount it and read/write data; fdisk -l /dev/loop4 does the expected thing; it shows up in lsblk; and /proc/partitions looks as expected:

  • Install pylint in Alpine Linux based Docker Image
  • Conditional fig configuration for dev needs
  • Exposing Docker Remote API v1.22 on CentOS7
  • How to change docker daemon root directory in CentOS7
  • How to initialize and run Docker on windows?
  • How to use the “Remote Systems” view in Eclipse to explore a Docker container file system?
  • root@e1047c0fa3a3:/proc# cat /proc/partitions 
    major minor  #blocks  name
    
     259        0  500107608 nvme0n1
     259        1     266240 nvme0n1p1
     259        2  494927872 nvme0n1p2
     259        3    4912455 nvme0n1p3
       7        0  104857600 loop0
       7        1    2097152 loop1
       7        4   25165824 loop4
     259        4   25164783 loop4p1
     254        0  104857600 dm-0
     254        1   10485760 dm-1
    

    BUT if I run just fdisk -l, ‘loop4’ doesn’t show up (only the system drive comes up), and apparently that’s how the install tool I’m using is looking for available drives, so I can’t pick ‘loop4’.

    fdisk -l on the host shows everything from /proc/partitions.

    Any ideas on what else fdisk looks for when listing devices?

    Update

    Apparently this is a problem specifically on 14, and 16 works as expected. Still would be nice to have a workaround on 14.

  • ASP.NET Core run angular build before docker build
  • Using docker for unit test
  • Accessing Secrets/Private Files Needed for Building in Dockerfile?
  • manage more than one Elasticsearch container with docker-compose
  • Is there an easy way to run an ipynb against an already running kernel non-interactively?
  • Docker-Compose with Docker 1.12 “Swarm Mode”
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.