Docker Community Forums

Share and learn in the Docker community.

Create a single service from docker-compose in Swarm cluster

Currently I can deploy whole stack to Swarm cluster using docker-compose.yml.

docker stack up -c docker-compose.yml

But is there any possibility to deploy a single service, using docker-compose.yml for bootstrapping it ?

Or maybe it’s planned to be developed later ?

I’m not sure, but maybe it’s the solution to use an inheritance

You can have just one service in the Compose file. Sure, it will create a docker stack that you don’t strictly need, but that’s no great inconvenience.

None of the proposed options are applicable.
We got docker-compose where the whole stack is defined.
But what todo when new service is added ?
Currently the only way is to recreate whole stack.

Currently the only way is to recreate whole stack.

I didn’t think it would create the whole stack from scratch. I thought it would just add in a service, so if it does that that strikes me as getting into bug turf.

But at any rate, if a stack is just an abstraction wrapping up some services and deleting / creating them can be done without disruption to service, what does it matter?

To be clear, IIRC you can update an existing stack by doing docker stack deploy -c docker-compose.yml stack again without needing to destroy it first.