Question: I have the below cassandra-compose.yml file which I am trying to deploy on a docker swarm with the below command.

```
  docker stack deploy --compose-file=cassandra-compose.yml cassandra-service

```

Issue:-

The Service is getting created but no replicas are running.When I inspected the issue, I found that because the mounted folder ie. ~/user/cassandraBackup is not present and that is why the container isn't started.

I tried to run it using docker-compose and it got executed successfully.
Can somebody tell me how to run it using stack-deploy 

Cassandra-compose.yml:-

```
  version: '3.1'
  services:

  multinode:
    image: cassandra:3.9
    deploy:
        replicas: 2
    volumes:
        - ~/user/cassandraBackup/:/var/lib/cassandra/data
    ports:
        - 7000:7000
        - 7001:7001
        - 7199:7199
        - 9042:9042
        - 9160:9160

```

Answer: 
try using this command :- 

```
docker stack deploy --compose-file=cassandra-compose.yml -f cassandra-compose.yml cassandra-service

```

It will get your issue resolved
From this answer <https://stackoverflow.com/a/48972713/2138959>:

[Docker Swarm BIND MOUNTS](https://docs.docker.com/engine/swarm/services/#bind-mounts)

> 
> If you bind mount a host path into your service’s containers, the path must exist on every swarm node. The Docker swarm mode scheduler can schedule containers on any machine that meets resource availability requirements and satisfies all constraints and placement preferences you specify.
> 
> 
> 

So you have to make sure the path is available to every node in the cluster the task can be scheduled to. But even with this approach container can be scheduled to a node with no or outdated data. So it is better to pin services to concrete nodes.