Dockler-Composite Scale Service with Independent Volumes

I am trying to write a compose file using a service (node) that I would like to scale to 3 containers. This service has a scope to be tied to my local system for persistence, but I would like different tasks to have different bindings to my system? I tried to use a template {{.Task.Slot}}

inside my docker-compose.yml as shown below, but I cannot figure it out to get it working ...

version: '3.2'
services:
     node:
        build:
            context: ./node
        volumes:
            - nodeVol:/data
        command: ["myapp"]

volumes:
    nodeVol:
        external:
            name: './persistence/{{.Task.Slot}}'

      

Any idea on what went wrong?

+3


source to share





All Articles