Multi-host compose application

I’ve a simple compose file, where I’ve three services A, B and C. Both A and B depends on C (i.e. have links to C). I’ve setup a Docker swarm on AWS and enabled overlay networking through consul key-store (I’ve been struggling for a while to get this working propoerly).

I can successfully launch the compose up with docker-compose up -d, but I get and error when I try to enable overlay for this app I get an error:

> docker-compose --x-networking --x-network-driver=overlay up

links, which are not compatible with Docker networking and will be ignored. Future versions of Docker will not support links - you should remove them for forwards-compatibility.

How I can run a compose application where I’ve dependencies between containers and scale the containers on a docker swarm?