title: Can't mount mounted block device inside a container: "is not a block device"
body: <p>I created a container with volume mount to <code>/dev/xvda1:/dev/xvda1</code> but when I tried to mount it to a folder it doesn't work:</p>
  <pre><code>root@ubuntu:/# docker run -v /dev/xvda1:/dev/xvda1 --cap-add=SYS_ADMIN  --security-opt apparmor=unconfined --security-opt seccomp=unconfined --rm -it ubuntu bash
  root@690798858fcf:/# mkdir /mnt0
  root@690798858fcf:/# ls /dev
  console  core  fd  full  mqueue  null  ptmx  pts  random  shm  stderr  stdin  stdout  tty  urandom  xvda1  zero
  root@690798858fcf:/# mount /dev/xvda1 /mnt0
  mount: /mnt0: /dev/xvda1 already mounted on /etc/resolv.conf.
  root@690798858fcf:/# umount /dev/xvda1
  root@690798858fcf:/# mount /dev/xvda1 /mnt0
  mount: /mnt0: /dev/xvda1 is not a block device; try &quot;-o loop&quot;.
  root@690798858fcf:/# mount -o loop /dev/xvda1 /mnt0
  mount: /mnt0: mount failed: Operation not permitted.
  </code></pre>
  <p>If I create it with <code>--privileged</code> flag it works:</p>
  <pre><code>root@ubuntu:/# docker run --privileged --cap-add=SYS_ADMIN  --security-opt apparmor=unconfined --security-opt seccomp=unconfined --rm -it ubuntu bash
  root@aa36dd8be903:/# mkdir /mnt0
  root@aa36dd8be903:/# mount /dev/xvda1 /mnt0
  root@aa36dd8be903:/#
  </code></pre>
  <p>Why <code>-v /dev/xvda1:/dev/xvda1</code> is not enough?</p>
  <p>Info about my system:</p>
  <pre><code># ubuntu image
  root@ubuntu:/# uname -r
  5.4.0-1034-aws
  
  root@ubuntu:/# docker -v
  Docker version 20.10.7, build f0df350  
  </code></pre>