Set scale: 2 in rancher-compose.yml ,but run 2 instances on just current host

I added 3 hosts to swarm env , I set scale: 2 in rancher-compose.ml ,but run 2 instances on just current host. there is no instance on the other two hosts

Without scheduling rules, there is no guarantee that your services will spread to different hosts.

Thanks,
If I want to run a container or service or stack on IP 192.168.0.102
how to set : io.rancher.scheduler.affinity:host_label: key1=value1
I don’t know key1 and value1

Is the IP 192.168.0.102, the IP of one of your hosts? I’m going to assume so.

If so, on that host, you need to click on “Edit” and add a new host label. After you’ve added the host label, you can start a service/container with a scheduling rule, where the key1=value1, is the key value pair that you added on the host.

Thanks ,
I know howto set ,I know howto get key and value what I set when I added host to swarm env before.