With Daytona, you can create and manage workspaces on another computer that is not your local computer.
This is useful if you have Arm-based servers on your local network or in the cloud and you want to use them for development.
There are two common use cases:
The first case is typical for computers on your local network or in the cloud that you do not pay for by the minute or hour.
The second case is for cloud resources that are billed as you use them (pay as you go) and you do not want to leave idle computers running.
By default, only the local Docker target is installed, but you can install additional targets. You can also configure multiple targets for each Daytona provider.
For example, Docker is a provider and you can configure the local Docker target, and multiple remote Docker targets. Each target corresponds to a different computer where you create and manage workspaces.
You can list the available targets using:
daytona target list
The output is:
Target Name: local
Target Provider: docker-provider
Default: Yes
Target Options: {
"Sock Path": "/var/run/docker.sock"
}
You can use Daytona to manage remote development environments for always-on computers, which corresponds to the first use case, using the Docker providers and SSH access to the computer.
Make sure Docker is installed on the remote computer.
You can use key based SSH to configure Daytona targets and manage remote workspaces.
If you are using a password to SSH to the remote computer, create a key-based SSH by putting a public key on the remote computer at $HOME/.ssh/authorized_keys
If you need to create a key pair, then you can use ssh-keygen
to create a key pair with a public and private key.
See the SSH install guide for more details.
Confirm that you can SSH to the remote computer using a private key:
ssh -i <private-key-file> user@ip
You need the name of the private key file on your local computer to configure a Daytona target.
Daytona allows you to manage remote development environments for always-on computers using the Docker provider.
daytona target set
Select the Docker provider then select New Target
.
Enter a name for the new target, such as the name of the machine, so that you can recognize it in the future.
Configure the target with the information below:
Remote Hostname: This is the IP address or the DNS name of the remote computer, if you have one.
Remote Password: This is not used, so leave it blank.
Remote Port: This is the SSH port, and the default is 22 unless you have changed the SSH configuration on the remote computer to use a different port.
Remote User: This is the username you use to SSH. It cannot be root.
Sock Path: This is the path to the Docker daemon. Keep the default.
Workspace Data Dir: This is the location where Daytona will store information on the remote computer. Leave the default, or change it to your preference.
The values are shown below:
In the next screen, enter the Remote Private Key Path. This is the path to the private key file that you use to SSH to the remote computer. It is the same file used to ssh -i <private-key-file>
Your target configuration is complete.
daytona target list
The output is:
daytona target list
Target Name: local
Target Provider: docker-provider
Target Options: {
"Sock Path": "/var/run/docker.sock"
}
===
Target Name: arm-server-1
Target Provider: docker-provider
Default: Yes
Target Options: {
"Remote Hostname": "XXX.XXX.XXX.XX",
"Remote Port": 22,
"Remote Private Key Path": "/home/jasand01/s1.key",
"Remote User": "ubuntu",
"Sock Path": "/var/run/docker.sock",
"Workspace Data Dir": "/tmp/daytona-data"
}
You see your new target and the parameters listed. It is now the default target.
You can use daytona create
to create a workspace on the remote computer. The command is the same as on the local computer. The default target is used: the new Docker remote computer.
daytona create --no-ide https://github.com/microsoft/vscode-remote-try-python/tree/main
You can also specify the target using the -t
option be explicit about which target to use:
daytona create -t arm-server-1 --no-ide https://github.com/microsoft/vscode-remote-try-python/tree/main
The daytona list
command shows the target where each workspace is running.
daytona list
If you have a workspace on both the local computer and the remote computer, the values in the target column are similar to:
Workspace Repository Target Status
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
vscode-remote-try-python microsoft/vscode-remote-try-python.git local RUNNING (1 minute)
vscode-remote-try-python2 microsoft/vscode-remote-try-python.git arm-server-1 RUNNING (3 minutes)
Be patient the first time you create the new workspace on the remote computer as it takes time to pull the Docker images.
The management commands from the previous section are the same on the local computer and the remote computer. This includes daytona code
and daytona ssh
. Use them in the same way for the remote workspace.
You have now learned how to manage remote development environments using the Docker provider.
In the next section, you can learn how to manage remote development environments using the AWS provider.