Attach a volume to a sandbox
To use a volume, attach it when you create a sandbox by passing an array of volume configurations to thevolumes property.
Each configuration must include the name of the volume to attach and the mountPath where it will be accessible inside the sandbox’s filesystem. The mount path will override the existing content of a directory.
Use createIfNotExists() / create_if_not_exists() so that re-running your setup code is safe even if the sandbox already exists with the volume attached:
/app directory within this sandbox will be stored on my-volume and will persist even if this sandbox is deleted.
At this time, you cannot detach a volume from a sandbox.
Check volume attachment status
Each volume returned from the API includes astate.attachedTo field indicating which sandbox the volume is currently attached to.
When a sandbox is deleted, Blaxel automatically clears this field on the volume. You can therefore check state.attachedTo directly to determine whether a volume is free to attach to a new sandbox.
Learn more about volumes
Learn how to create and manage volumes.
Learn more about volume templates
Pre-populate volumes with files for faster environment setup.
