docker swarm stack network code example
Example 1: create a swarm-scoped network
$ docker network create -d overlay my-overlay
Example 2: docker swarm deploy
docker stack deploy -c "path to compose" stackname
$ docker network create -d overlay my-overlay
docker stack deploy -c "path to compose" stackname