Creating a local docker registry

docker service create --name registry --publish published=5000,target=5000 registry:2

Creating a Swarm - Master Node( For example in EC2 Instance 1)

docker swarm init --advertise-addr <IP> --listen-addr <IP>

This will generate a token using which other nodes can join the cluster. To see the token use

docker swarm join-token worker

Networking(Overlay)

Creating a Overlay Network all the nodes in the cluster across EC2 instacnes can communicate using DNS

docker network create -d overlay <name> --attachable
docker network ls
docker network inspect <name>

Cluster

See all the nodes in a Cluster

docker node ls

View all services