Claiming volumes

Learn how services can claim volumes that should be mounted to enable persistence

By default all files created inside a container are stored on a writable container layer. This means that:

  • The data doesn’t persist when that container no longer exists, and it can be difficult to get the data out of the container if another process needs it.
  • A container’s writable layer is tightly coupled to the host machine where the container is running. You can’t easily move the data somewhere else.
  • Writing into a container’s writable layer requires a storage driver to manage the filesystem. The storage driver provides a union filesystem, using the Linux kernel. This extra abstraction reduces performance as compared to using data volumes, which write directly to the host filesystem.

Taken from Docker's documentation on storage.


Since container file systems can't be shared across replicas and won't persist if the container crashes or restarts, developers may want access to a mounted file system that can be shared and is tolerant to container failures. In order to enable this across platforms, Architect has a generalized way for service creators to cite volume claims that they will need mounted in order for them to operate effectively. These volume claims are fulfilled automatically by Architect during each deployment to ensure availability and proper attachment across different container environments.

To claim a volume that must be available to your application, cite it directly in your service configuration file:

{
  "volumes": {
    "my_volume": {
      "description": "Temporary storage for images to perform computer vision tasks on",
      "mount_path": "/container/directory/to/mount/to"
    }
  }
}

Since services don't know where they will be deployed to, the service config doesn't need or want to hardcode any details of the host path that will fulfill the mount. Instead, they are only responsible for naming the volume, describing its purpose, and citing where in the container runtime the volume should be mounted.

On This Page
Previous
Datastores