Hi all,
I have a process that I run regularly on my host PC. I download the stock Debian beaglebone image, mount the image as loopback devices, chroot into it, and make some changes.
I would like to do this same thing in a docker container via a gitlab pipeline. That is, when I tag a new version of our software, the pipeline builds it and then makes a new image with the new version installed.
I can't figure out how to get this to work. It seems like the container needs elevated permissions and/or access to the host's loopback device nodes, and I can't really find good resources for how this can work in gitlab. Beyond that, though, all I'm doing is manipulating the contents of a file I own, so it seems strange that there's no way to do that without elevated privileges.
As it is, what I'm trying (and failing) to do, looks something like this:
Quote:
mkdir -p /tmp/dev
mknod -m 0660 /tmp/dev/loop0 b 7 0
/sbin/losetup -P /tmp/dev/loop0 ./my-image.img
|
So, I make a loopback device (because one doesn't exist), then try to use losetup to hook it up to that image. Gitlab says the pipeline fails because "losetup: /tmp/dev/loop0: failed to set up loop device: Operation not permitted"
So, in googling that, I found a lot of people doing similar things, but no real solutions (and a lot of very old, obsolete posts). This got me thinking about why I need any elevated privileges at all, because really all I want to do is dump some files into the image.
I don't know much about fuse, but is that a potential answer? Or is there something else I'm missing that would work well here? And if I just need to force docker to let me do these thing, how would that work in gitlab?
Thanks