Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 88072e8

Browse files
MDzajavedranjukic
andauthored
Volumes (#346)
Signed-off-by: Vedran Jukic <[email protected]> Signed-off-by: MDzaja <[email protected]> Co-authored-by: Vedran Jukic <[email protected]>
1 parent 6bebaac commit 88072e8

File tree

17 files changed

+688
-35
lines changed

17 files changed

+688
-35
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "docs",
33
"license": "Apache-2.0",
44
"type": "module",
5-
"version": "0.16.0",
5+
"version": "0.17.0",
66
"scripts": {
77
"postinstall": "is-ci || husky",
88
"dev": "astro dev --host",

public/llms-full.txt

Lines changed: 105 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Daytona Documentation v0.16.0
2-
# Generated on: 2025-05-05
1+
# Daytona Documentation v0.17.0
2+
# Generated on: 2025-05-07
33

44

55
title: API Keys
@@ -2156,7 +2156,7 @@ Setting the auto-stop interval parameter to `0` will disable the auto-stop funct
21562156

21572157
### Basic Sandbox Creation
21582158

2159-
Daytona SDK provides methods to create Sandboxes with default configurations, specific languages, or custom IDs using Python and TypeScript.
2159+
Daytona SDK provides methods to create Sandboxes with default configurations, specific languages, or custom labels using Python and TypeScript.
21602160

21612161
```python
21622162
from daytona_sdk import Daytona
@@ -2172,9 +2172,9 @@ sandbox = daytona.create()
21722172
params = CreateSandboxParams(language="python")
21732173
sandbox = daytona.create(params)
21742174

2175-
# Create a Sandbox with custom ID
2175+
# Create a Sandbox with custom labels
21762176

2177-
params = CreateSandboxParams(id="my-sandbox")
2177+
params = CreateSandboxParams(labels={"SOME_LABEL": "my-label"})
21782178
sandbox = daytona.create(params)
21792179

21802180
```
@@ -2189,13 +2189,13 @@ const sandbox = await daytona.create();
21892189
// Create a Sandbox with specific language
21902190
const sandbox = await daytona.create({ language: 'typescript' });
21912191

2192-
// Create a Sandbox with custom ID
2193-
const sandbox = await daytona.create({ id: 'my-sandbox' });
2192+
// Create a Sandbox with custom labels
2193+
const sandbox = await daytona.create({ labels: { SOME_LABEL: 'my-label' } });
21942194
```
21952195

21962196

21972197
:::note
2198-
Daytona keeps a pool of ready-to-go "warm" Sandboxes. When available, they are automatically used if a custom ID _isn't_ provided and the default image is used, reducing the creation time down to a fraction of a second.
2198+
Daytona keeps a pool of ready-to-go "warm" Sandboxes. When available, they are automatically used if the default image is used, reducing the creation time down to a fraction of a second.
21992199
:::
22002200

22012201
### Sandbox Resources
@@ -2794,6 +2794,103 @@ The Images Quota is the maximum number of Images that can be created in an Organ
27942794

27952795
The Total image size Quota is the maximum amount of disk space that can be used by Images in an Organization expressed in gigabytes.
27962796

2797+
title: Volumes
2798+
2799+
import { Tabs, TabItem } from '@astrojs/starlight/components';
2800+
2801+
Volumes are FUSE-based mounts on the Sandbox file system that enable file sharing between Sandboxes and instant access to existing files already present on the mounted volume.
2802+
Using Volumes the Sandboxes can instantly read from large files eliminating the need to upload them first to the Sandbox file system.
2803+
The volume data is stored on the S3 compatible object store. Multiple volumes can be mounted to a single Sandbox and each volume can be mounted on multiple Sandboxes simultaneously.
2804+
2805+
## Creating Volumes
2806+
2807+
In order to mount a volume to a Sandbox, one must be created.
2808+
2809+
```bash
2810+
volume = daytona.volume.get("my-volume", create=True)
2811+
```
2812+
```bash
2813+
const volume = await daytona.volume.get('my-volume', true)
2814+
```
2815+
2816+
## Mounting Volumes to Sandboxes
2817+
2818+
Once a volume is created, it can be mounted to a Sandbox by specifying it in the `CreateSandboxParams` object:
2819+
2820+
```python
2821+
import os
2822+
from daytona_sdk import CreateSandboxParams, Daytona, VolumeMount
2823+
2824+
daytona = Daytona()
2825+
2826+
# Create a new volume or get an existing one
2827+
volume = daytona.volume.get("my-volume", create=True)
2828+
2829+
# Mount the volume to the sandbox
2830+
mount_dir_1 = "/home/daytona/volume"
2831+
2832+
params = CreateSandboxParams(
2833+
language="python",
2834+
volumes=[VolumeMount(volumeId=volume.id, mountPath=mount_dir_1)],
2835+
)
2836+
sandbox = daytona.create(params)
2837+
2838+
# When you're done with the sandbox, you can remove it
2839+
# The volume will persist even after the sandbox is removed
2840+
daytona.remove(sandbox)
2841+
2842+
```
2843+
2844+
```typescript
2845+
import { Daytona } from '@daytonaio/sdk'
2846+
import path from 'path'
2847+
2848+
async function main() {
2849+
const daytona = new Daytona()
2850+
2851+
// Create a new volume or get an existing one
2852+
const volume = await daytona.volume.get('my-volume', true)
2853+
2854+
// Mount the volume to the sandbox
2855+
const mountDir1 = '/home/daytona/volume'
2856+
2857+
const sandbox1 = await daytona.create({
2858+
language: 'typescript',
2859+
volumes: [{ volumeId: volume.id, mountPath: mountDir1 }],
2860+
})
2861+
2862+
// When you're done with the sandbox, you can remove it
2863+
// The volume will persist even after the sandbox is removed
2864+
await daytona.remove(sandbox1)
2865+
}
2866+
2867+
main()
2868+
2869+
```
2870+
2871+
2872+
## Deleting Volumes
2873+
2874+
When a volume is no longer needed, it can be removed.
2875+
2876+
```python
2877+
volume = daytona.volume.get("my-volume", create=True)
2878+
daytona.volume.delete(volume)
2879+
```
2880+
```typescript
2881+
const volume = await daytona.volume.get('my-volume', true)
2882+
await daytona.volume.delete(volume)
2883+
```
2884+
2885+
## Working with Volumes
2886+
2887+
Once mounted, you can read from and write to the volume just like any other directory in the Sandbox file system. Files written to the volume persist beyond the lifecycle of any individual Sandbox.
2888+
2889+
## Limitations
2890+
2891+
Since volumes are FUSE-based mounts, they can not be used for applications that require block storage access (like database tables).
2892+
Volumes are generally slower for both read and write operations compared to the local Sandbox file system.
2893+
27972894
title: Web Terminal
27982895

27992896
import { Tabs, TabItem } from '@astrojs/starlight/components';

public/llms.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Daytona Documentation v0.16.0
2-
# Generated on: 2025-05-05
1+
# Daytona Documentation v0.17.0
2+
# Generated on: 2025-05-07
33

44
# Daytona
55

@@ -145,4 +145,10 @@
145145
- [Disk Quota](https://daytona.io/docs/usage#disk-quota)
146146
- [Sandboxes/Running Sandboxes Quota](https://daytona.io/docs/usage#sandboxesrunning-sandboxes-quota)
147147
- [Images/Total Image Size Quota](https://daytona.io/docs/usage#imagestotal-image-size-quota)
148+
- [Volumes](https://daytona.io/docs/volumes)
149+
- [Creating Volumes](https://daytona.io/docs/volumes#creating-volumes)
150+
- [Mounting Volumes to Sandboxes](https://daytona.io/docs/volumes#mounting-volumes-to-sandboxes)
151+
- [Deleting Volumes](https://daytona.io/docs/volumes#deleting-volumes)
152+
- [Working with Volumes](https://daytona.io/docs/volumes#working-with-volumes)
153+
- [Limitations](https://daytona.io/docs/volumes#limitations)
148154
- [Web Terminal](https://daytona.io/docs/web-terminal)

public/search.json

Lines changed: 85 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@
11211121
},
11221122
{
11231123
"title": "Basic Sandbox Creation",
1124-
"description": "Daytona SDK provides methods to create Sandboxes with default configurations, specific languages, or custom IDs using Python and TypeScript.",
1124+
"description": "Daytona SDK provides methods to create Sandboxes with default configurations, specific languages, or custom labels using Python and TypeScript.",
11251125
"tag": "Documentation",
11261126
"url": "/docs/sandbox-management#basic-sandbox-creation",
11271127
"slug": "/sandbox-management#basic-sandbox-creation",
@@ -1144,11 +1144,11 @@
11441144
"objectID": 143
11451145
},
11461146
{
1147-
"title": "Create a Sandbox with custom ID",
1147+
"title": "Create a Sandbox with custom labels",
11481148
"description": "",
11491149
"tag": "Documentation",
1150-
"url": "/docs/sandbox-management#create-a-sandbox-with-custom-id",
1151-
"slug": "/sandbox-management#create-a-sandbox-with-custom-id",
1150+
"url": "/docs/sandbox-management#create-a-sandbox-with-custom-labels",
1151+
"slug": "/sandbox-management#create-a-sandbox-with-custom-labels",
11521152
"objectID": 144
11531153
},
11541154
{
@@ -1535,12 +1535,92 @@
15351535
"slug": "/usage#imagestotal-image-size-quota",
15361536
"objectID": 192
15371537
},
1538+
{
1539+
"title": "Volumes",
1540+
"description": "Volumes are FUSE-based mounts on the Sandbox file system that enable file sharing between Sandboxes and instant access to existing files already present on the mounted volume.",
1541+
"tag": "Documentation",
1542+
"url": "/docs/volumes",
1543+
"slug": "/volumes",
1544+
"objectID": 193
1545+
},
1546+
{
1547+
"title": "Creating Volumes",
1548+
"description": "In order to mount a volume to a Sandbox, one must be created.",
1549+
"tag": "Documentation",
1550+
"url": "/docs/volumes#creating-volumes",
1551+
"slug": "/volumes#creating-volumes",
1552+
"objectID": 194
1553+
},
1554+
{
1555+
"title": "Mounting Volumes to Sandboxes",
1556+
"description": "Once a volume is created, it can be mounted to a Sandbox by specifying it in the `CreateSandboxParams` object:",
1557+
"tag": "Documentation",
1558+
"url": "/docs/volumes#mounting-volumes-to-sandboxes",
1559+
"slug": "/volumes#mounting-volumes-to-sandboxes",
1560+
"objectID": 195
1561+
},
1562+
{
1563+
"title": "Create a new volume or get an existing one",
1564+
"description": "",
1565+
"tag": "Documentation",
1566+
"url": "/docs/volumes#create-a-new-volume-or-get-an-existing-one",
1567+
"slug": "/volumes#create-a-new-volume-or-get-an-existing-one",
1568+
"objectID": 196
1569+
},
1570+
{
1571+
"title": "Mount the volume to the sandbox",
1572+
"description": "",
1573+
"tag": "Documentation",
1574+
"url": "/docs/volumes#mount-the-volume-to-the-sandbox",
1575+
"slug": "/volumes#mount-the-volume-to-the-sandbox",
1576+
"objectID": 197
1577+
},
1578+
{
1579+
"title": "When you're done with the sandbox, you can remove it",
1580+
"description": "",
1581+
"tag": "Documentation",
1582+
"url": "/docs/volumes#when-youre-done-with-the-sandbox-you-can-remove-it",
1583+
"slug": "/volumes#when-youre-done-with-the-sandbox-you-can-remove-it",
1584+
"objectID": 198
1585+
},
1586+
{
1587+
"title": "The volume will persist even after the sandbox is removed",
1588+
"description": "",
1589+
"tag": "Documentation",
1590+
"url": "/docs/volumes#the-volume-will-persist-even-after-the-sandbox-is-removed",
1591+
"slug": "/volumes#the-volume-will-persist-even-after-the-sandbox-is-removed",
1592+
"objectID": 199
1593+
},
1594+
{
1595+
"title": "Deleting Volumes",
1596+
"description": "When a volume is no longer needed, it can be removed.",
1597+
"tag": "Documentation",
1598+
"url": "/docs/volumes#deleting-volumes",
1599+
"slug": "/volumes#deleting-volumes",
1600+
"objectID": 200
1601+
},
1602+
{
1603+
"title": "Working with Volumes",
1604+
"description": "Once mounted, you can read from and write to the volume just like any other directory in the Sandbox file system.",
1605+
"tag": "Documentation",
1606+
"url": "/docs/volumes#working-with-volumes",
1607+
"slug": "/volumes#working-with-volumes",
1608+
"objectID": 201
1609+
},
1610+
{
1611+
"title": "Limitations",
1612+
"description": "Since volumes are FUSE-based mounts, they can not be used for applications that require block storage access (like database tables).",
1613+
"tag": "Documentation",
1614+
"url": "/docs/volumes#limitations",
1615+
"slug": "/volumes#limitations",
1616+
"objectID": 202
1617+
},
15381618
{
15391619
"title": "Web Terminal",
15401620
"description": "Daytona provides a Web Terminal for interacting with your Sandboxes, allowing for a convenient way to view files, run commands, and debug.",
15411621
"tag": "Documentation",
15421622
"url": "/docs/web-terminal",
15431623
"slug": "/web-terminal",
1544-
"objectID": 193
1624+
"objectID": 203
15451625
}
15461626
]

src/content/config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,15 @@ export const sidebarConfig: NavigationGroup[] = [
277277
icon: 'server.svg',
278278
},
279279
},
280+
{
281+
type: 'link',
282+
href: '/docs/volumes',
283+
label: 'Volumes',
284+
description: 'Learn how to manage volumes in your Daytona Sandboxes.',
285+
attrs: {
286+
icon: 'container-registries.svg',
287+
},
288+
},
280289
],
281290
},
282291
{

src/content/docs/python-sdk/daytona.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ It can be initialized either with explicit configuration or using environment va
1919
- `api_key` _str_ - API key for authentication.
2020
- `api_url` _str_ - URL of the Daytona API.
2121
- `target` _str_ - Default target location for Sandboxes.
22+
- `volume` _VolumeService_ - Service for managing volumes.
2223

2324
**Example**:
2425

@@ -117,7 +118,7 @@ params = CreateSandboxParams(
117118
language="python",
118119
image="debian:12.9",
119120
env_vars={"DEBUG": "true"},
120-
resources=SandboxResources(cpu=2, memory=4096),
121+
resources=SandboxResources(cpu=2, memory=4),
121122
auto_stop_interval=0
122123
)
123124
sandbox = daytona.create(params, 40)

src/content/docs/python-sdk/file-system.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ be performed within a Daytona Sandbox.
2222

2323
```python
2424
def __init__(instance: SandboxInstance, toolbox_api: ToolboxApi,
25-
root_dir: str)
25+
get_root_dir: Callable[[], str])
2626
```
2727

2828
Initializes a new FileSystem instance.
@@ -31,7 +31,7 @@ Initializes a new FileSystem instance.
3131

3232
- `instance` _SandboxInstance_ - The Sandbox instance this file system belongs to.
3333
- `toolbox_api` _ToolboxApi_ - API client for Sandbox operations.
34-
- `root_dir` _str_ - The default root directory of the Sandbox.
34+
- `get_root_dir` _Callable[[], str]_ - A function to get the default root directory of the Sandbox.
3535

3636
#### FileSystem.create\_folder
3737

src/content/docs/python-sdk/git.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ sandbox.git.commit(
4343

4444
```python
4545
def __init__(sandbox: "Sandbox", toolbox_api: ToolboxApi,
46-
instance: SandboxInstance, root_dir: str)
46+
instance: SandboxInstance, get_root_dir: Callable[[], str])
4747
```
4848

4949
Initializes a new Git handler instance.
@@ -53,7 +53,7 @@ Initializes a new Git handler instance.
5353
- `sandbox` _Sandbox_ - The parent Sandbox instance.
5454
- `toolbox_api` _ToolboxApi_ - API client for Sandbox operations.
5555
- `instance` _SandboxInstance_ - The Sandbox instance this Git handler belongs to.
56-
- `root_dir` _str_ - The default root directory of the Sandbox.
56+
- `get_root_dir` _Callable[[], str]_ - A function to get the default root directory of the Sandbox.
5757

5858
#### Git.add
5959

0 commit comments

Comments
 (0)