Docker Community Forums

Share and learn in the Docker community.

How to attach a service from docker-compose to an overlay network

Hello eveyone!

I want to use docker swarm with docker-compose file to deploy services in multiple worker node.
How can I attach service in each worker into an overlay network?

I have researched and saw that I just can user this command to join service to an overlay network

$ docker service create \
  --replicas 3 \
  --name my-web \
  --network my-network \
  nginx

Anyone can help me to do it with docker-compose file by using **docker stack deploy** command?