Ah yes, that was one of the main selling points of docker early on, fixing the "works on my machine".
The way I solve that problem is by working directly on testing/staging servers which have the same specs as production.
I almost never run stuff on my local machine, and if I do it's a well isolated piece of code whose IO signature I know exactly and I can mock external systems with ease.