First, define your user-defined bridge network:
docker network create your-network-name
Then, connect your containers to the network that you just created:
docker network connect your-network-name container-name
Or connect with the run command:
docker run --network=your-network-name your-image
Now, containers in the same network your-network-name can talk to each others via container name.