Volumes
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):
- platform: 20200213T123742Z
- volapi: release-20200423
- cnapi: release-20200227
- cloudapi: release-20200423
- sdc-docker: release-20200423
When using volumes with triton-docker, there are limitations on volumes that are slightly different from Docker Inc's docker:
- There is a limit of 8 data volumes per container.
- Host volumes (/hostpath:/containerpath) are not supported.
- You cannot delete a container with a volume that is shared with another
container via
--volumes-from
. You must first delete all containers using that volume. - There is a limit of 1
--volumes-from
argument per container. - When you use
--volumes-from
, you are necessarily co-provisioned with the container you are sharing the volumes from. If the physical host on which the source container exists does not have capacity for the new container, provisioning a new container using--volumes-from
will fail. - When you use
--volumes-from
, volumes that don't belong to the container specified (including those that this container is sharing from others) are ignored. Only volumes belonging to the specified container will be considered.
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