Required and optional configuration
A singleton service can declare one volume. The declaration requires:
The resulting project-scoped name is
<service>.<name>, up to 127
characters, where <service> is the name of the deployment declaration that
instantiates the definition.
YAML composition example
In YAML composition, a volume declaration is a mapping withname, size_gb, and mount_path inside the service definition’s
optional volumes list. Omitting volumes, setting it to null, or using
[] declares no volume.
The singleton cache service mounts cache.data at /data. Redis writes its
append-only persistence files there, and the volume retains them across
container replacement.
volume object with
the scoped name, size_gb, and mount_path.
Lifecycle
Declaring a new volume name provisions storage and binds the volume to the service; declaring an existing volume that no service is bound to binds it. A volume is bound to one service at a time. A new version with the same volume name reuses its data, including when its mount path changes. A deployment that removes the volume declaration unbinds it; deleting the service also unbinds its volume and preserves its data. A deployment that declares a largersize_gb for an existing volume makes a
new version of its service and grows the volume while the service runs. The
deployment requests the size and completes without waiting for it; the
volume’s storage then grows, and the running container sees the added space
within seconds, without a restart. Until the storage has grown, the growth is
pending: the volume’s requested size is larger than its size. A pending growth
is retried until it is made. A new version that declares the volume’s current
size or less withdraws it; a deployment that leaves the service unchanged
leaves it pending. Storage is charged at the volume’s size, the grown size
from the minute the volume shows it.
A volume never shrinks: a deployment that declares a size_gb smaller than
the volume’s is accepted and leaves the volume at its size. A volume whose
storage is still being created takes the size of the latest deployment that
declares it.
A fresh volume contains lost+found.
Deleting a volume requires name confirmation and destroys its data; it is
refused while a service is bound to the volume. The volume is removed once
its storage is released, and a deployment that declares the name of a
volume being deleted is refused.

