Using the XFS filesystem in a Gitlab runner

We are adding a CI/CD stage to our pipeline to automatically run a set of important integration tests on the full system.

The thing is, this system must have access to a docker socket that has an overlay2 storage driver backed by an XFS filesystem. Our current approach is to use the docker in docker image, have xfsprog create an XFS formatted file, and then mount that file inside the container that the CI/CD job is running. Since the image is Docker in Docker, in theory the Docker daemon inside the image should then be able to be backed by that volume. The trouble is that mounting however does not work. I ran the following sequence of commands in a before_script:

    - apk update
    - apk add xfsprogs
    - touch xfs.bin
    - mkfs.xfs -d size=1g xfs.bin
    - mkdir /xfs
    - mount -o prjquota -t xfs xfs.bin /xfs

This works fine if I locally run the docker:24.0.5 image, however when I run this inside the CI/CD pipeline running on shared runners, I get:

mount: mounting /dev/loop0 on /xfs failed: Invalid argument

I am aware that I may be running into the limitations of GitLab Runners, especially the shared ones that we do not control, but is there any way to get this to work, or is there any way that we can get a docker daemon to be available to our application which is backed by XFS?

We are running with shared runners on an SaaS GitLab Ultimate instance.

The error message could mean that mounting a filesystem from within CI/CD might need elevated permissions, or the driver does not support it. Never tried mounting a device in CI/CD yet.

For this specific test requirement, I’d suggest trying a self-hosted GitLab Runner with specific Docker configuration for volumes and/or running privileged containers.