I agree but how does this work with stateful apps

Pass data around. Run a local HTTP server or any other type of socket, like how Docker does.