Hot to control automatic paralelization running FEniCS in Docker?

Hi everyone,
I’m trying to run a script in a FEniCS docker container (stable) with mpirun on Ubuntu Mate 20.04, executing:

sudo mpirun -n 4 python3 main.py

Where I added sudo because my script is ment to write some files in the shared folder.

However, I observed that each thread calls the solver routine on all the available threads, making the program execution slower.
This has already been reported in previous topic (Mumps in parallel slower than in serial and Fenics in Docker automatic parallelization), but setting OMP_NUM_THREADS to 1 or changing the solver didn’t sove my issue.
Do you know any other way to have control on the number of threads used by the script?
Thank you in advance.