Qt moc gets stuck when running in a docker container

I am trying to compile a code which uses Qt inside a docker container. The container runs Ubuntu 20.04 with Qt 5.12.5 from official repository, and the host machine CentOS 7. Compilation gets stuck at running moc on on a parameter file:

/usr/lib/qt5/bin/moc @/HERD/software/source/geant4.10.04.p02.build/source/interfaces/basic/include/moc_G4UIQt.cpp_parameters

which produces no output on screen and remains running forever, and I have to kill moc with ctrl+c. The content of the parameter file is ok: moc runs fine on it outside the container, and also putting the content of the file directly on the moc command line works in the container. So it seems a problem related with file access/processing by moc from inside the container. Indeed, running moc on any other file (also non-parameters one) leads to a halt without any message; the only sign of life appears when passing a non existent file:

$ /usr/lib/qt5/bin/moc @nonexistent.file
moc: Cannot open options file specified with @

In this thread on StackOverflow I found that Qt >= 5.10 makes use of statx calls when compiled with kernel >= 4.12, which is the case of the Ubuntu Qt package I installed in my container, while the host CentOS system has kernel 3.10 by default. So I updated the CentOS kernel of the host machine to 5.6.2 vial elrepo, to no avail. I am not a docker expert, so I can’t really tell if this kernel upgrade should be enough to fix the problem (supposing that I correctly identify the problem itself), or if I should also re-build docker on CentOS with the new kernel.
Thanks for any help.