In machine1 initialize the docker swarm
docker swarm init --advertise-addr IP_address
You'll get this:

Add the docker swarm join --token command in your machine2 and machine3.
Now you have a 3-node swarm. Back on Machine 1 you can create a multi-host overlay network:
docker network create -d overlay my-app
And then you run workloads in the network by deploying services.