c_costel why do I need to have the source code in both containers?
I don't think you really need the "source code" in both containers. You probably only need the assets folder in your Nginx container.
The problem is that the files in this folder are generated by Flarum each time you change a setting or add/remove an extension, so you need to keep it in sync between the two containers...
The index.php file and other source code needs to be in the phpfpm container, because, well, that's the source code phpfpm is trying to parse ?
I'm not sure how exactly Nginx works, but maybe it needs the index.php, api.php, admin.php files locally for the fpm call to work (?) No idea if Nginx checks if the file exists or if it simply passes the file name to fpm...