1

I have a build process which manipulates some floppy images(files) by mounting them inside a docker container.

Everything works well with one container but if I run a second container i can't mount anything there although i use different loop devices.

If I then go back to the first container and do a umount I can mount in the second container without any problems .

There are 2 behaviours i have observed either the mount command hangs forever or it instantly fails with :

mount: /tmp/ng-mmi7Ao-NGFW-Fresh-72x-Box/NGFW-Fresh-72x-Box.flp: failed to setup loop device: No such file or directory

Any Ideas how to solve this issue so i am able to mount images via a loopback interface on multiple containers ?

Additonal Details:

Container Overview and trying to mount a floppy image in the second container:

CONTAINER ID        IMAGE                                             COMMAND                  CREATED             STATUS              PORTS                   NAMES
4181a8e5e8c7        10.0.0.201:5000/jenkins_autotest_slave:latest   "/usr/local/bin/setu…"   40 hours ago        Up 40 hours         127.0.0.1:32800->22/tcp   gallant_saha
0218fdce8ed7        10.0.0.201:5000/jenkins_autotest_slave:latest   "/usr/local/bin/setu…"   47 hours ago        Up 47 hours         127.0.0.1:32798->22/tcp   reverent_feistel

[qa@jenkins-staging ~]$ docker exec -ti 4181 bash
[root@4181a8e5e8c7 /]# sudo /usr/bin/mount -o loop=/dev/loop1,uid=1000 /tmp/ng-mmi7Ao-NGFW-Fresh-72x-Box/NGFW-Fresh-72x-Box.flp /tmp/ng-mmi7Ao-NGFW-Fresh-72x-Box/mp
mount: /tmp/ng-mmi7Ao-NGFW-Fresh-72x-Box/NGFW-Fresh-72x-Box.flp: failed to setup loop device: No such file or directory
[root@4181a8e5e8c7 /]# exit

Now unmount on first container

[qa@jenkins-staging ~]$ docker exec -ti 0218fdce8ed7 bash
[root@0218fdce8ed7 /]# sudo umount /tmp/ng-blabla-NGFW-Fresh-72x-Box/mp ## UMOUNT SO OTHER COTAINER CAN MOUNT
[root@0218fdce8ed7 /]# exit

Now second container can mount

[qa@jenkins-staging ~]$ docker exec -ti 4181 bash
[root@4181a8e5e8c7 /]# sudo /usr/bin/mount -o loop=/dev/loop1,uid=1000 /tmp/ng-mmi7Ao-NGFW-Fresh-72x-Box/NGFW-Fresh-72x-Box.flp /tmp/ng-mmi7Ao-NGFW-Fresh-72x-Box/mp
[root@4181a8e5e8c7 /]# exit ### MOUNT WAS SUCCESSFULL IN SECOND CONTAINER

Try again in first container :

[qa@jenkins-staging ~]$ docker exec -ti 0218fdce8ed7 bash
[root@0218fdce8ed7 /]# date
Tue Apr 16 13:50:28 UTC 2019
[root@0218fdce8ed7 /]# sudo /usr/bin/mount -o loop=/dev/loop0,uid=1000 /tmp/ng-blabla-NGFW-Fresh-72x-Box/NGFW-Fresh-72x-Box.flp /tmp/ng-blabla-NGFW-Fresh-72x-Box/mp # MOUNT KEEPS HANGING NOW ON FIRST CONTAINER
^C
[root@0218fdce8ed7 /]# date
Tue Apr 16 13:57:21 UTC 2019

Docker and OS Version:

[qa@jenkins-staging ~]$ docker -v
Docker version 18.09.5, build e8ff056
[qa@jenkins-staging ~]$ uname -a
Linux jenkins-staging 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[qa@jenkins-staging ~]$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)

Docker run command:

docker run --privileged --device-cgroup-rule="b 7:* rmw" -p :22 10.0.0.201:5000/jenkins_autotest_slave:latest qa@jenkins-staging"
yashC
  • 887
  • 7
  • 20
Mino_e
  • 393
  • 3
  • 16

1 Answers1

1

Although I don't know why docker/linux/mount is behaving in such a stupid way I found a workaround (or, let's say, a better solution) for my issue which allows to create floppy images without mounting them.

create a virtual floppy image without mount?

Additionally, this has the benefit that it doesn't need any extra permissions so I can do a docker run without --privileged --device-cgroup-rule="b 7:* rmw".

tshepang
  • 12,111
  • 21
  • 91
  • 136
Mino_e
  • 393
  • 3
  • 16