Containers in different custom docker networks can’t communicate so the only way as far as I know is having a common network for both containers.
I don’t really understand the issue as you mention emulating machines " under the same WIFI network" so you don’t need multiple networks.
A single Docker network doesn’t mean the containers won’t have their own IP address. They will have, but they will be in the same subnet so they can communicate.
What you probably thought is using the same network namespace, which would mean two containers have the same “localhost” as well, but by default each container has its own IP on the network.
I realize my mistake now, I didn’t know they would have their own IP address under the same network. I wasn’t understanding the setup I wanted correctly.
I will set it back to a single docker network and work with that.