We are trying to use docker containers to make our software builds repeatable in baselined environment. One of the tools in the build toolchain (Wind River) is called mkromfs, it grabs files in certain folder, converts them to a filesystem that is then loadable to the rom on targert platform (which is an embedded device, but that is not important here). The issue is: that utility relies on filesystem order of files and gives different results when I run the container on Linux RHEL host and different results when I run it in Linux VM (Docker for Windows with Linux containers support enabled, I don't know what Linux distro is inside...). Basically the same can be quickly reproduced by generating folder with files a and b, and then doing ls -f on the folder, different hosts give files in different order (although the results seem to be repeatable on that specific hosts).
The container we use is based on ubuntu latest, but same issue occurred if I try another base images, it seems to rely on host system, not the container (my guess is that it actually uses the host file system somehow, but I thought dockers use union FS).
Now of course I do not want to risk that someone will try to repeat the build on slightly different Linux host in the future and will come to a different result. I also understand that order of ls -f (or readdir() internally) is given by OS and filesystem. I also cannot change mkromfs utility since there is no source available to it.
My tries and ideas were so far:
Is there some way to save the docker container approach and have this process repeatable? Ideally there would be no difference in build run in container on remote Linux host as is on my Windows 10 machine running Docker with Linux support. I am new to the whole docker container technology and partially also to Linux, I must have missed something...
I have found a solution working for my case, here it is in case anyone else needs it in the future:
docker run -t -d --mount type=tmpfs,destination=/build myimage
This way the /build directory in the container uses same filesystem on all machines (at least it looks like that so far). More about this at https://docs.docker.com/storage/tmpfs/ .
With this change, the ls -f as well as the utility are providing same results.