I’ve been playing with the latest docker-compose ( version 1.3.1 ) and have been trying to scale up a pair of services. In particular a webservice container with a link to mongo shard-routing server ( mongos server ). Ideally, each webservice container will have it’s own mongos container ( a mongo recommended configuration ).
I have a 2-node docker swarm managed with docker-machine ( 0.4.0-dev ). I can successfully bring up the webservice + mongos on a single node with compose. But when I try to scale services up to 2, I get a problem with the links. Compose seems to try to create links between my new webservice container and both mongos container:
$ docker-compose scale prodmongos=2 webservice=2 Starting new HTTPS connection (1): 192.168.99.100 Creating sample_prodmongos_2... Starting sample_prodmongos_2... Creating sample_webservice_2... Unable to find a node fulfilling all dependencies: --link=sample_prodmongos_1:prodmongos_1 --link=sample_prodmongos_1:sample_prodmongos_1 --link=sample_prodmongos_1:stg_mongos.internal.tallac.com --link=sample_prodmongos_2:prodmongos_2 --link=sample_prodmongos_2:sample_prodmongos_2 --link=sample_prodmongos_2:stg_mongos.internal.tallac.com
My docker-compose file looks like:
webservice: image: "private/webservice:123" ports: ["8080"] links: ["prodmongos:mongos_host"] prodmongos: image: "private/mongodb" command: [ "mongos", "--configdb", "192.168.99.101:30001", "--port", "27017" ]
My expectation would have been that the sample_webservice_2 webservice container would only be linked to the sample_prodmongos_2 container and not to both the sample_prodmongos_1 and sample_prodmongos_2.
Is there a way to get around this behavior?