Docker create a replica node that can access multiple gpu

Now I working around with docker-compose and GPU. I want to create a service that can access multiple GPU. I some idea to create it ,but I don’t know it really work. So, I want to discuss my idea with you.

I test my service on stress test with one gpu and it doesn’t work well.So I estimate the ram usage in my service and I conclude 2 gpu can work well.

So I write a config in docker-compose config that it can access two gpu and replica it two node. Do you think I write it correct ?

    build: .
      mode: replicated
      replicas: 2
          - driver: nvidia
            device_ids: ('0', '1')
            capabilities: (gpu)