Skip to content

Workspaces

Workspaces serve as isolated environments containing your project’s codebase, dependencies, packages, and configuration, providing a consistent and reproducible setup for development, testing, and deployment.

They ensure that changes in one project do not inadvertently affect another, promoting a more stable and reliable workflow. This is particularly beneficial in collaborative settings, as it ensures that all team members are working with the same configuration, reducing the likelihood of environment-related issues.

Create a Workspace

Creating a Workspace in Daytona is a straightforward process that ensures you have a dedicated development environment for your projects.

Daytona provides two primary methods for creating a Workspace:

From a Git Repository

Creating a Workspace from a Git repository sets up a new development environment using a connected Git Provider or a custom Git repository URL.

  1. Run the following command to create a Workspace from a Git repository:
Terminal window
daytona create

  1. Select one of the three provided options:
  • Select from a List of Repositories

    If you connected a Git Provider, you will be presented with a list of your repositories from which you can select to connect with your Workspace.

  • Enter a Custom Repository URL

    Alternatively, select the 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 from a Sample project provided by Daytona. This option sets up a new development environment using quick-start templates.

Choose a Git Provider
3 items
===
GitHub
Enter a custom repository URL
Create from Sample
  1. Select the Git repository from the list, enter the URL of the Git repository you want to link with your Workspace, or choose to create a Workspace from a sample project.

  2. Enter a name for your Workspace.

Workspace name
>

  1. Select a Target to deploy your Workspace to. Selecting a Target will prompt you to input the Target configuration. The configurations vary based on the selected Target.
Choose a Target
6 items
===
local
docker-provider
Add a Docker Provider Target
docker-provider (needs installing)
Add a Digital Ocean Provider Target
digitalocean-provider (needs installing)
Add an AWS Provider Target
aws-provider (needs installing)
Add a GCP Provider Target
gcp-provider (needs installing)
Add an Azure Provider Target
azure-provider (needs installing)
Add a Hetzner Provider Target
hetzner-provider (needs installing)
Add a Fly.io Provider Target
fly-provider (needs installing)

Upon Target selection and configuration, Daytona will clone the specified Git repository and set up a new Workspace based on its contents. You will see progress information in the terminal, indicating the process of creating a Workspace.

WORKSPACE | ✓ Request submitted
WORKSPACE | ✓ Creating workspace daytona
daytona | Creating project daytona
daytona | Pulling image...
daytona | Pulling from daytonaio/workspace-project
...
daytona | Project daytona created
daytona | Starting project daytona
daytona | Project daytona started

From an Arbitrary Git URL

Creating a Workspace from an arbitrary Git URL sets up a new development environment by directly specifying the URL of the remote repository.

  1. Run the following command to create a Workspace from a remote Git repository:
Terminal window
daytona create <REPO_URL>

Example

Terminal window
daytona create https://github.com/daytonaio/daytona.git
  1. Select a Target to deploy your Workspace to. Selecting a Target will prompt you to input the Target configuration. The configurations vary based on the selected Target.
Choose a Target
6 items
===
local
docker-provider
Add a Fly.io Provider Target
fly-provider (needs installing)
Add a Docker Provider Target
docker-provider (needs installing)
Add a Digital Ocean Provider Target
digitalocean-provider (needs installing)
Add an AWS Provider Target
aws-provider (needs installing)
Add an Azure Provider Target
azure-provider (needs installing)

Upon Target selection and configuration, Daytona will clone the specified Git repository and set up a new Workspace based on its contents. You will see progress information in the terminal, indicating the process of creating a Workspace.

Once complete, the Workspace will be ready for use with the specified repository and configuration.

WORKSPACE | ✓ Request submitted
WORKSPACE | ✓ Creating workspace daytona
daytona | Creating project daytona
daytona | Pulling image...
daytona | Pulling from daytonaio/workspace-project
...
daytona | Project daytona created
daytona | Starting project daytona
daytona | Project daytona started

Create a Workspace with Multiple Projects

Daytona allows you to create a Workspace that contains multiple repositories, which we refer to as Projects. This enables you to work on several codebases simultaneously within a single environment.

Multiple projects are deployed within the same virtual machine or instance depending on the Provider infrastructure, allowing you to manage and develop multiple projects in a unified Workspace.

Regardless of the infrastructure type, all projects are managed consistently within the Workspace.

  1. Run the following command to create a Workspace with multiple projects:
Terminal window
daytona create --multi-project
  1. Select one of the three provided options:
  • Select from a List of Repositories

    If you choose a Git provider (e.g., GitHub), you will be presented with a list of your repositories from which you can select the desired repository.

  • Enter a Custom Repository URL

    Alternatively, select the 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 repository ready, choose to create a Workspace from a sample project provided by Daytona. This option allows you to set up a new development environment using quick-start templates.

Choose a Git Provider
3 items
===
GitHub
Enter a custom repository URL
Create from Sample
  1. Select the Git repository from the list, enter the URL of the Git repository you want to link with your Workspace, or choose to create a Workspace from a sample project.

After your selection, you will be prompted to add a second project to the Workspace.

Choose a Git Provider (Project #2)
3 items
===
GitHub
Enter a custom repository URL
Create from Sample
  1. Select the Git repository from the list for the second project, enter the URL of the Git repository you want to link with your Workspace, or choose to create a Workspace from a sample project.

After adding the second project, you will be prompted to add another project to the Workspace.

Add another project?
[Yes] [No]

Selecting Yes will allow you to add additional projects to the Workspace. Once you have added all the projects you need, select No to complete the Workspace creation process.

After adding all projects, you will be prompted with a summary of the Workspace configuration.

SUMMARY
Project #1 - https://github.com/daytonaio/sample-python.git
Build Automatic
Image daytonaio/workspace-project:latest
User daytona
Project #2 - https://github.com/daytonaio/sample-go.git
Build Automatic
Image daytonaio/workspace-project:latest
User daytona
  1. Enter a name for your Workspace.
Workspace name
>
  1. Select a Target to deploy your Workspace to. Selecting a Target will prompt you to input the Target configuration. The configurations vary based on the selected Target.
Choose a Target
6 items
===
local
docker-provider
Add a Docker Provider Target
docker-provider (needs installing)
Add a Digital Ocean Provider Target
digitalocean-provider (needs installing)
Add an AWS Provider Target
aws-provider (needs installing)
Add a GCP Provider Target
gcp-provider (needs installing)
Add an Azure Provider Target
azure-provider (needs installing)
Add a Hetzner Provider Target
hetzner-provider (needs installing)
Add a Fly.io Provider Target
fly-provider (needs installing)

Upon Target selection and configuration, Daytona will clone the specified Git repository and set up a new Workspace based on its contents. You will see progress information in the terminal, indicating the process of creating a Workspace.

Once complete, the Workspace will be ready for use with the specified repository and configuration.

WORKSPACE | ✓ Request submitted
WORKSPACE | ✓ Creating workspace daytona
daytona | Creating project daytona
daytona | Pulling image...
daytona | Pulling from daytonaio/workspace-project
...
daytona | Project daytona created
daytona | Starting project daytona
daytona | Project daytona started

List Workspaces

Daytona allows you to keep track of your development environments by listing all previously created Workspaces. This helps you manage multiple projects and ensure that you can easily access and maintain your Workspaces.

  1. Run the following command:
Terminal window
daytona list

Upon running this command, Daytona will display a list of your Workspaces with their details. You will be able to see the Workspace name, the repository it is connected to, the target of the Workspace, and its status.

Workspace Repository Target Status
─────────────────────────────────────────────────────────────────────
MyWorkspace username/MyProject local RUNNING (30 minutes)

Open An Existing Workspace

Daytona allows you to open an existing Workspace in your IDE. This enables you to quickly access and work on your projects in your preferred development environment. With Daytona, you can effortlessly switch between different Workspaces and maintain an efficient workflow.

  1. Run the following command:
Terminal window
daytona code

Upon running this command, Daytona will display a list of your Workspaces with their details. You will be able to see the Workspace name, the unique identifier of the Workspace, and the repository it is connected to.

Select a Workspace To Open
1 item
┃ MyProject
┃ abcdefg12hi3 (local)
┃ github.com/username/MyProject.git
  1. Select the Workspace you want to open.

Delete Workspaces

Daytona allows you to delete one or more Workspaces, helping you manage your development environments by removing those that are no longer needed.

  1. Run the following command:
Terminal window
daytona delete

Upon running this command, Daytona will display a list of your Workspaces with their details. You will be able to see the Workspace name, the unique identifier of the Workspace, and the repository it is connected to.

Select Workspaces To Delete
1 item
┃ MyWorkspace
┃ abcdefg12hi3 (local)
┃ github.com/username/MyProject.git
  1. Mark Workspaces for deletion by highlighting them and pressing x.

  2. Press Enter on the selected Workspace to delete it.

Delete: MyWorkspace
┃ abcdefg12hi3 (local)
┃ github.com/username/MyProject.git
  1. Confirm the action.
Delete workspace(s): [MyWorkspace]?
Are you sure you want to delete the workspace(s): [MyWorkspace]?
[Yes] [No]
Workspace MyWorkspace successfully deleted

Non-Interactively

Daytona allows you to delete one or more existing Workspaces non-interactively, allowing for quick and automated cleanup of your development environments without manual selection.

  1. Run the following command, specifying the workspace names/UUIDs to delete:
Terminal window
daytona delete WORKSPACE_1 WORKSPACE_2

Upon running this command, Daytona will prompt you to confirm the deletion of the specified Workspace. You will be able to see the Workspace name that you are about to delete, and you will have the option to confirm or cancel the action.

Delete workspace(s): [MyWorkspace]?
Are you sure you want to delete the workspace(s): [MyWorkspace]?
[Yes] [No]
  1. Confirm the action to delete the selected Workspace.
Workspace MyWorkspace successfully deleted

Forward Ports from a Workspace

Daytona supports flexible port forwarding, allowing you to access services running in a Workspace locally or via a shareable public URL. With port forwarding, you can work on your project in a Workspace and test your code externally.

Access a Port Locally

You can access services running in a Workspace on your local machine.

Prerequisite

  • A running Workspace with at least one service accessible via TCP/UDP.
  1. Run the following command to forward a port from a running Workspace to your local machine:
Terminal window
daytona forward <PORT> <WORKSPACE> <PROJECT>

Example: Allow local access to port 4321 of the example-dev-env Workspace.

Terminal window
daytona forward 4321 example-dev-env

Upon running this command, Daytona will establish a port forwarding connection from the specified port in the Workspace to your local machine. The terminal will display a message indicating the local port where the forwarded connection is available:

Port available at http://localhost:4321

Access a Port via Public URL

You can access services running in a Workspace via a generated public URL. This allows you to share your work with others in real-time.

Prerequisite

  • A running Workspace with at least one service accessible via TCP/UDP.
  1. Run the following command to generate a public URL for a port on a running Workspace:
Terminal window
daytona forward <PORT> <WORKSPACE> <PROJECT> --public

Example: Generate a URL to access port 4321 of the example-dev-env Workspace.

Terminal window
daytona forward 4321 example-dev-env --public

Upon running this command, Daytona will first establish a local port forwarding connection and display a message indicating the local port where the forwarded connection is available.

Port available at http://localhost:4321

Then, Daytona will proceed to forward the port to a public URL. The terminal will display progress information and, upon completion, provide the generated public URL.

Forwarding port to a public URL...
Port available at:
https://4321-ABC1DeF2GhI3JkLmNoP4RSTuVZ5.try-eu.daytona.app

This URL can be shared with others to provide real-time access to the service running on the specified port in your Workspace.