title: Using {{.Task.Slot}} in Docker volumes
body: <p>I would like to mount individual volumes to each replica of my Docker service using the <code>{{.Task.Slot}}</code> syntax:</p>
  
  <pre><code>services:
    foo:
      ...
      volumes:
        - type: volume
          source: foo{{.Task.Slot}}
          target: /mnt
      deploy:
        mode: replicated
        replicas: 3
  
  volumes:
    foo1:
      ...
    foo2:
      ...
    foo3:
      ...
  </code></pre>
  
  <p>However, Docker fails with:</p>
  
  <pre><code>service foo: undefined volume "foo{{.Task.Slot}}"
  </code></pre>
  
  <p>It seems that the Go syntax is not interpreted in the <code>source</code> property but in the <code>target</code> property, it works smoothly:</p>
  
  <pre><code>services:
    foo:
      ...
      volumes:
        - type: volume
          source: foo1
          target: /mnt{{.Task.Slot}}
  </code></pre>
  
  <p>But that's obviously not what I need.</p>