Volumes

Modified: 25 Jun 2020 12:18 UTC
Stability: Unknown

Triton provides users an NFS based shared storage capability through volapi. These volume instances can also set tags that can then be referenced by other (regular) create instance calls, to achieve a near/far relationship to the volume (or for volumes in relation to other volumes).

Volumes were also added to the Triton Terraform provider as of version 0.7. See Triton: Volume Resource for more information.

The following minimum versions allow for full production volapi functionality (previous versions may support experimental * volapi v1 functionality):

When using volumes with triton-docker, there are limitations on volumes that are slightly different from Docker Inc's docker:

Example

The following example shows a docker compose yml utilizing two volume/container pairs utilizing Affinity in order to co-locate each volume with its container on the same compute node, but separate each container/volume pair from the other pair by way of different compute nodes.

version: '2.2'
services:
  es01:
    image: busybox
    command: sleep 8640000
    container_name: volconsumer1
    volumes:
      - data01:/data
    networks:
      - fabric
    labels:
      - "com.docker.swarm.affinities=[\"volumename==data01\"]"

  es02:
    image: busybox
    command: sleep 8640000
    container_name: volconsumer2
    volumes:
      - data02:/data
    networks:
      - fabric
    labels:
      - "com.docker.swarm.affinities=[\"volumename==data02\"]"

volumes:
  data01:
    driver: tritonnfs
    labels:
      - role=volume
      - volumename=data01
      - "com.docker.swarm.affinities=[\"role!=volume\"]"

  data02:
    driver: tritonnfs
    labels:
      - role=volume
      - volumename=data02
      - "com.docker.swarm.affinities=[\"role!=volume\"]"

networks:
  fabric:
    driver: bridge
    external: true
    name: My-Fabric-Network