> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runloop.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Mount Files Inline

> Inject file content directly into your Devbox at creation time

<Tip>Start with the [Runloop Quickstart](/docs/tutorials/quickstart) to use the examples below.</Tip>

## Overview

File Mounts allow you to inject file content directly into your Devbox at creation time. This is ideal for small configuration files, scripts, or any text content that you want to include without uploading to storage first.

<Note>
  For larger files or binary data, consider using [Object Mounts](/docs/devboxes/mounts/object-mounts) instead. For runtime file operations, see [Read and Write Files](/docs/devboxes/files).
</Note>

### Use Cases

File mounts are particularly useful for:

* **Configuration files**: Inject JSON, YAML, or TOML configuration
* **Environment files**: Add `.env` files with environment-specific settings
* **Scripts**: Include setup scripts or utility scripts
* **SSH keys**: Add authorized keys or known hosts
* **Small data files**: Include test fixtures or sample data

## Creating a File Mount

Use the `mounts` parameter with `type: "file_mount"` to inject file content:

<CodeGroup>
  ```python Python theme={null}
  devbox = await runloop.devbox.create(
    mounts=[
      {
        "type": "file_mount",
        "target": "/home/user/config.json",
        "content": '{"api_url": "https://api.example.com", "debug": true}'
      }
    ]
  )

  # Verify the file was created
  content = await devbox.file.read("/home/user/config.json")
  print(content)  # {"api_url": "https://api.example.com", "debug": true}
  ```

  ```typescript TypeScript theme={null}
  const devbox = await runloop.devbox.create({
    mounts: [
      {
        type: "file_mount",
        target: "/home/user/config.json",
        content: '{"api_url": "https://api.example.com", "debug": true}'
      }
    ]
  });

  // Verify the file was created
  const content = await devbox.file.read("/home/user/config.json");
  console.log(content);  // {"api_url": "https://api.example.com", "debug": true}
  ```
</CodeGroup>

### File Mount Parameters

| Parameter | Required | Description                                    |
| --------- | -------- | ---------------------------------------------- |
| `type`    | Yes      | Must be `"file_mount"`                         |
| `target`  | Yes      | Absolute path where the file should be created |
| `content` | Yes      | The text content of the file                   |

## Examples

### Mounting a Python Script

<CodeGroup>
  ```python Python theme={null}
  script_content = '''#!/usr/bin/env python3

  if __name__ == "__main__":
    print("Hello from mounted script!")
  '''

  devbox = await runloop.devbox.create(
    mounts=[
      {
        "type": "file_mount",
        "target": "/home/user/setup.py",
        "content": script_content
      }
    ]
  )

  # Run the script
  result = await devbox.cmd.exec("python /home/user/setup.py")
  print(await result.stdout())  # Hello from mounted script!
  ```

  ```typescript TypeScript theme={null}
  const scriptContent = `#!/usr/bin/env python3

  if __name__ == "__main__":
    print("Hello from mounted script!")
  `;

  const devbox = await runloop.devbox.create({
    mounts: [
      {
        type: "file_mount",
        target: "/home/user/setup.py",
        content: scriptContent
      }
    ]
  });

  // Run the script
  const result = await devbox.cmd.exec("python /home/user/setup.py");
  console.log(await result.stdout());  // Hello from mounted script!
  ```
</CodeGroup>

### Mounting Multiple Configuration Files

<CodeGroup>
  ```python Python theme={null}
  devbox = await runloop.devbox.create(
    mounts=[
      {
        "type": "file_mount",
        "target": "/home/user/.env",
        "content": "DATABASE_URL=postgres://localhost:5432/mydb\nAPI_KEY=secret123"
      },
      {
        "type": "file_mount",
        "target": "/home/user/app/config.yaml",
        "content": "server:\n  port: 8080\n  host: 0.0.0.0"
      },
      {
        "type": "file_mount",
        "target": "/home/user/.gitconfig",
        "content": "[user]\n  name = AI Agent\n  email = agent@example.com"
      }
    ]
  )
  ```

  ```typescript TypeScript theme={null}
  const devbox = await runloop.devbox.create({
    mounts: [
      {
        type: "file_mount",
        target: "/home/user/.env",
        content: "DATABASE_URL=postgres://localhost:5432/mydb\nAPI_KEY=secret123"
      },
      {
        type: "file_mount",
        target: "/home/user/app/config.yaml",
        content: "server:\n  port: 8080\n  host: 0.0.0.0"
      },
      {
        type: "file_mount",
        target: "/home/user/.gitconfig",
        content: "[user]\n  name = AI Agent\n  email = agent@example.com"
      }
    ]
  });
  ```
</CodeGroup>

## Limitations

* **Text content only**: File mounts support UTF-8 text content. For binary files, use [Object Mounts](/docs/devboxes/mounts/object-mounts).
* **Size limits**: Individual file mounts have a maximum size limit of 12KB. The total size of all file mounts is limited to 128KB. For unlimited access, use [Object Mounts](/docs/devboxes/mounts/object-mounts).
* **Absolute paths**: The `target` path must be an absolute path (e.g., `/home/user/file.txt`).

## Best Practices

1. **Use for small files**: File mounts are best for configuration files and small scripts. For larger files, use Object Mounts.
2. **Avoid sensitive data**: Don't include secrets directly in file content. Use [Account Secrets](/docs/devboxes/configuration/account-secrets) instead.
3. **Use absolute paths**: Always specify the full path starting with `/`.
4. **Create parent directories**: Parent directories are created automatically if they don't exist.
