Creating diskimage in gitlab-ci via docker runner

Hi all,
I have the problem that i’m unable to create and mount a diskimage in docker gitlab-ci runner
Parts of my ci script are

- SYSDEVICE=$(losetup -f)
- dd if=/dev/zero of=test.img bs=1M count=512 status=progress
- losetup -v -P $SYSDEVICE test.img
- echo "partitioning"
- sgdisk --zap-all $SYSDEVICE
- sgdisk --new=1:0:0 --typecode=1:ef00 $SYSDEVICE
- echo "creating filesystem"
- mkfs.vfat -F32 -i 0x640805CA -n PLAYER-INST "$SYSDEVICE"
- losetup -d $SYSDEVICE

So, what actually does not work is losetup -v -P $SYSDEVICE test.img, but it doesn’t fail. There isn’t even any output in the build log.
Normally this should create a loopback device like /dev/loop4p1, but this is not created.
The ci container is running in privillged mode.
Does anyone have any hint on ehat i’m doing wrong here? This all works flawlessly if i execute it on a linux machine.
Many thanks in advance.

In the meantime I think I found a solution or workaround.
Thanks to issue 3732 I was lead in the right direction.
Just had to create the loopback device under /tmp/dev/and everything was working.