Container Scheduling not work

Hi ,
I want to use Docker Run command to start a container on another docker host with label storage set to ssd, so I followed the steps in below link:-

the command is like:-
docker run -l -l “io.rancher.scheduler.affinity:host_label: storage=ssd” -itd mariadb bash

However, I found the container was still created on the docker host where I run the Docker Run Command, instead of the one with the storage label.

From the Rancher UI–>Add container, the scheduling affinity could work.

Is there anything wrong with my steps or understanding? Pls help.

Thanks a lot!

There is no scheduling when you do docker run. You’re physically starting a container on that host, and Rancher only finds out about it after the fact and “imports” it to show on the host it was already started on.

Services and using rancher-compose will start containers according to the scheduling labels.

Got it, thanks for your prompt response:).