Skip to content

Workspace Templates

A Workspace Template is designed to simplify the management of development environments, allowing you to predefine settings that can be easily applied to any new Workspace.

A Workspace Template contains all necessary properties to define and manage Workspaces within a Workspace. It stores information such as the repository URL, build configuration, and environment variables. This allows for easy reuse of previously set templates, ensuring a consistent and reproducible setup across multiple Workspaces.

A Workspace Template encapsulates all the essential elements for setting up a Workspace, including:

  • Repository URL

    The URL of the Git repository associated with the Workspace.

  • Build Configuration

    Automatic auto-detects the most appropriate Builder for your Workspace.

    Devcontainer utilizes a predefined development container specified by a devcontainer.json file.

    Custom image builds the Workspace image by specifying a custom base container.

    None builds a Workspace by using the default base image (daytonaio/workspace-project).

  • Environment Variables

    Environment variables are specified in the KEY=VALUE format. These variables are essential for the Workspace’s build and runtime environments. You can set the variables directly or pass them from the machine’s environment during execution.

  • Workspace Template name

    A unique identifier for the Workspace Template, which distinguishes it from other Template within the system.

With the daytona workspace-template command, you can add, view, update, list, set as default, or delete Workspace Templates, giving you full control over the Template and reuse of your Workspace setups across different Workspaces.

Create a Workspace Template

Daytona provides an option to add a Workspace Template, enabling you to store and reuse Workspace properties across multiple Workspaces.

  1. Run the following command to add a Workspace Template:
Terminal window
daytona workspace-template add
  1. Select one of the two provided options available for creating a Workspace Template:
  • Enter a custom repository URL

    An option to enter a custom repository URL manually if the repository is not listed under your Git Provider account or is from an external source.

  • Create from Sample

    If you do not have a Git repository ready, you can create a Workspace Template from a Sample project provided by Daytona.

  1. Enter the repository URL of the Workspace you want to configure, or select to create a Workspace Template from a sample project.
Git repository
>
  1. Enter a name for the Workspace Template.
Name
>
  1. Select the build configuration for the Workspace.
Choose a build configuration
Automatic
Devcontainer
Custom image
None
  1. Enter the environment variables for the Workspace in the KEY=VALUE format.
Environment Variables
Enter environment variables in the format KEY=VALUE
To pass machine env variables at runtime, use $VALUE

Upon completion, Daytona will output a summary of the Workspace Template, enabling you to review the properties before saving it.

SUMMARY - Workspace Template
Workspace - MyWorkspace
Repository https://github.com/daytonaio/docs
Branch main
Build Automatic
Image daytonaio/workspace-project:latest
User daytona
  1. Click Create to save the Workspace Template, or Configure to make changes to the Workspace Template.
Workspace template <workspace_template> added successfully

List Workspace Templates

Daytona provides an option to list all Workspace Templates, providing you with an overview of the properties stored within each Template.

  1. Run the following command to list all Workspace Templates:
Terminal window
daytona workspace-template list

Upon running this command, Daytona will display a list of your Workspace Templates. You will be able to view the Workspace Template name, the repository URL it is connected to, the build configuration, and if it is set as a default Template.

Name Repository Build Default
────────────────────────────────────────────────────────────────────
MyWorkspaceConfig daytonaio/daytona Devcontainer Yes

Update Workspace Template

Daytona provides an option to update an existing Workspace Template, enabling you to modify the properties stored within it.

  1. Run the following command to update a Workspace Template:
Terminal window
daytona workspace-template update
  1. Select the Workspace Template you want to update.
Select a Workspace Template To Update
1 item
MyWorkspaceTemplate
https://github.com/username/MyWorkspace
Workspace Template updated successfully

Delete Workspace Template

Daytona provides an option to delete an existing Workspace Template, enabling you to remove properties that are no longer needed.

  1. Run the following command to delete a Workspace Template:
Terminal window
daytona workspace-template delete
  1. Select the Workspace Template you want to delete.
Select a Workspace Template To Delete
1 item
MyWorkspaceTemplate
https://github.com/username/repository
Workspace Template deleted successfully

Workspace Template Information

Daytona provides an option to view detailed information of a Workspace Template, providing you with an overview of the properties stored within it.

  1. Run the following command to view the details of a Workspace Template:
Terminal window
daytona workspace-template info

Upon running this command, Daytona will display a list of your Workspace Templates.

  1. Select the Workspace Template you want to view.
Select a Workspace Config To View
1 item
MyWorkspaceConfig
https://github.com/username/MyWorkspace

Upon selecting the Workspace Template, Daytona will display the details of the selected Template. You will be able to view the Workspace Template name, the repository URL it is linked to, the build configuration, and the Devcontainer path.

Workspace Config Info
Name MyWorkspaceConfig
Repository https://github.com/username/MyWorkspace
Build Devcontainer
Devcontainer path .devcontainer/devcontainer.json

Set Default Workspace Template

Daytona provides an option to set a default Workspace Template, enabling you to define a Template that will be used by default when creating new Workspaces.

  1. Run the following command to set a default Workspace Template:
Terminal window
daytona workspace-template set-default
  1. Select the Workspace Template you want to set as the default.
Select a Workspace Template To Set As Default
1 item
MyWorkspaceTemplate
https://github.com/username/MyWorkspace

Upon selecting the default Workspace Template, Daytona will set it as the default Template for new Workspaces.

Workspace Template 'MyWorkspaceTemplate' set as default
  1. Update the properties of the Workspace Template.
Choose a build configuration
Automatic
Devcontainer
Custom image
None
Environment Variables
Enter environment variables in the format KEY=VALUE
To pass machine env variables at runtime, use $VALUE

Upon completion, Daytona will save the updated Workspace Template, allowing you to reuse it across Workspaces.

Workspace Template updated successfully

Import Workspace Template

Daytona provides an option to import a Workspace Template, enabling you to reuse existing Workspace properties across multiple Workspaces.

  1. Run the following command to import a Workspace Template:
Terminal window
daytona workspace-template import
  1. Enter the Workspace Template as a JSON object or an array of JSON objects.
Import Workspace Template
Enter Workspace Template as a JSON object or an array of JSON objects
  • An empty example of the JSON object properties format:
[
{
"buildConfig": {},
"default": true,
"envVars": {},
"image": "",
"labels": null,
"name": "",
"repositoryUrl": "",
"user": ""
}
]

Export Workspace Template

Daytona provides an option to export a Workspace Template, enabling you to save the properties of a Workspace Template as a JSON object.

  1. Run the following command to export a Workspace Template:
Terminal window
daytona workspace-template export
  1. Select the Workspace Template you want to export.
Select a Workspace Template To Export
1 item
MyWorkspaceTemplate
https://github.com/username/repository

Upon selecting the Workspace Template you want to export, Daytona will output the properties of the selected Template as a JSON object.

[
{
"buildConfig": {},
"default": true,
"envVars": {},
"image": "daytonaio/workspace-project:latest",
"labels": null,
"name": "MyWorkspaceTemplate",
"repositoryUrl": "https://github.com/username/repository",
"user": "daytona"
}
]