Create a Workspace
Create a Workspace
You can create a workspace either from the DevPod CLI or through the DevPod desktop application. A workspace can be created from a git repository, a local path or a docker container (e.g. golang:latest).
Upon successful creation, DevPod will make the development container available through the ssh host WORKSPACE_NAME.devpod. Alternatively, DevPod can automatically open the workspace in a locally installed IDE, such as VS Code or Intellij.
A workspace is defined through a devcontainer.json. If DevPod can't find one, it will automatically try to guess the programming language of your project and provide a fitting template.
Via DevPod Desktop Application
Navigate to the 'Workspaces' view and click on the 'Create' button in the title. Enter the git repository you want to work on or select a local folder.
If you haven't configured a provider yet, DevPod will automatically open the provider modal for you. You can later add providers in the same way by navigating to 'Providers' > 'Add'
You can also configure one of the additional settings:
- Provider: The provider to use for this workspace. Cannot be changed later.
- Default IDE: The ide to open after successfully creating this workspace. Can be changed later.
- Workspace Name: Override the automatically determined workspace name with this option. Cannot be changed later.
- Prebuild Repository: A docker image repository such as
ghcr.io/my-org/my-repothat contains prebuilds for this workspace. DevPod will try to automatically find a fitting prebuild for this workspace in the given repository.
Then press Create Workspace to launch the workspace.
Under the hood, the Desktop Application will call the CLI command devpod up REPOSITORY
You can set the location of your devpod home by passing the --devpod-home={home_path} flag,
or by setting the env var DEVPOD_HOME to your desired home directory.
This can be useful if you are having trouble with a workspace trying to mount to a windows location when it should be mounting to a path inside the WSL VM.
For example: setting devpod-home=/mnt/c/Users/MyUser/ will result in a workspace path of something like /mnt/c/Users/MyUser/.devpod/contexts/default/workspaces/...
Via DevPod CLI
Make sure to install the DevPod CLI locally and select a provider you would like to host the workspace on (such as local docker) via:
# Add a provider if you haven't already
devpod provider add docker
Git Repository
Run the following command in a terminal to start a new workspace:
# Create from git repository
devpod up github.com/microsoft/vscode-remote-try-node
You can check out specific states of the repository by appending a commit hash, branch or Pull Request slug to the repository url:
Branch: devpod up github.com/microsoft/vscode-remote-try-node@main
Commit: devpod up github.com/microsoft/vscode-remote-try-node@sha256:15ba80171af11374143288fd3d54898860107323
PR: devpod up github.com/microsoft/vscode-remote-try-node@pull/108/head # Only works for GitHub!
DevPod will forward git credentials to a remote machine so that you can also pull private repositories.
Use the --id flag to override the name of the workspace. This allows you to create multiple workspaces from the same repository.
Local Path
Run the following command in a terminal to create a new workspace:
# Create from a local path
devpod up ./path/to/my-folder
DevPod will sync the folder into the remote machine and create a development environment from the devcontainer.json.
Which files are uploaded
When the workspace runs on another machine or in Kubernetes, DevPod uploads the folder. If the folder is in a git
repository, DevPod only uploads the files git doesn't ignore: tracked files, and untracked files that no
.gitignore file, .git/info/exclude or core.excludesFile ignores. So build output, node_modules and the like
stay behind, as do other repositories and git worktrees inside the folder. The files of submodules are uploaded.
If the folder is the top of the repository, the workspace gets a small .git in place of yours, with only the
checked out commit, so that you can commit and push from the workspace. It has the same branch, remotes and
upstream branch as yours, and the commits since your branch and its upstream branch diverged, but no other
history. Changes you have staged show as not staged in the workspace. Each checked out submodule gets a small
.git of its own in the same way.
A .devpodignore file at the top of the folder takes precedence over git. It has the syntax of a
.dockerignore file, so patterns are
relative to the folder: build only matches the build folder at the top, **/build matches one anywhere. A
pattern leaves out files git doesn't ignore, and a negation (!) pattern uploads files git ignores:
# a file git ignores, but the workspace needs
!.env
# files git doesn't ignore, but the workspace doesn't need
docs/**/*.mp4
Tracked files that .devpodignore leaves out don't show as deleted in the workspace, as git marks them
skip-worktree, but their content is still uploaded
in the small .git. !.git uploads your whole .git instead of the small one, and .git uploads no .git at all.
If the folder is not in a git repository, or git is not installed, DevPod uploads every file .devpodignore
doesn't exclude.
When the workspace runs on your machine, e.g. with the docker provider and a local Docker, the folder is mounted
and not uploaded, so the workspace has all of it.
Docker Image
Run the following command in a terminal to create a new workspace from a docker image:
# Create from a docker image
devpod up ghcr.io/my-org/my-repo:latest
DevPod will create the following .devcontainer.json:
{
"image": "ghcr.io/my-org/my-repo:latest"
}
Existing local container
If you have a local container running, you can create a workspace from it by running:
devpod up my-workspace --source container:$CONTAINER_ID
This only works with the docker provider.
Using --recreate on a workspace based on an already existing container will be rejected.
Common options
devpod up has many flags. These are the ones you use most, each with an example. devpod up --help lists them all.
Choose the name of the workspace, for example to have two workspaces of the same repository, and choose the provider and its options for this workspace only:
devpod up github.com/my-org/my-repo --id my-repo-experiment
devpod up github.com/my-org/my-repo --provider kubernetes --provider-option KUBERNETES_NAMESPACE=team-a
Choose what to open the workspace with, or open nothing and only start it (see Connect to a Workspace):
devpod up my-workspace --ide goland
devpod up my-workspace --ide none
devpod up my-workspace --ide vscode --open-ide=false # install the IDE's server, but don't open the IDE
Use another devcontainer.json, or an image, instead of the one in the project (see
devcontainer.json):
devpod up . --devcontainer-path .devcontainer/backend/devcontainer.json
devpod up . --devcontainer-image mcr.microsoft.com/devcontainers/go:1.23
devpod up . --fallback-image ubuntu:24.04 # only used if the project has no devcontainer.json
Clone less of a big repository, or its submodules too:
devpod up github.com/my-org/big-repo --git-clone-strategy blobless
devpod up github.com/my-org/big-repo --git-clone-strategy shallow
devpod up github.com/my-org/my-repo --git-clone-recursive-submodules
Give the dev container environment variables, a dotfiles repository or a git identity (see Environment variables, Dotfiles and Git identity):
devpod up my-workspace --workspace-env MY_ENV_VAR=my-value --workspace-env-file ./workspace.env
devpod up my-workspace --dotfiles https://github.com/my-user/dotfiles
devpod up my-workspace --git-user-name "My Name" --git-user-email me@company.com
Use a prebuilt image, or a machine that already exists (see Prebuild a Workspace and Manage Machines):
devpod up github.com/my-org/my-repo --prebuild-repository ghcr.io/my-org/my-repo
devpod up github.com/my-org/my-repo --provider aws --machine my-big-machine
Don't add the workspace to ~/.ssh/config, or add it to another file:
devpod up my-workspace --configure-ssh=false
devpod up my-workspace --ssh-config ~/.ssh/devpod-config
Change where DevPod keeps its state for one command, or for the whole shell:
devpod up my-workspace --devpod-home /mnt/c/Users/MyUser
export DEVPOD_HOME=/mnt/c/Users/MyUser
Recreating a workspace
If you are working on the devcontainer.json or have pulled changes that affect the development environment, you can recreate a workspace. Recreating a workspace means to apply changes in the devcontainer.json or related Dockerfile to the development environment. If a prebuild repository is supplied, DevPod will try to find the updated development environment image inside the prebuild repository and if not found will fall back to building it.
When recreating a workspace, changes only to the project path or mounted volumes will be preserved. All other changes made in the container will be lost.
Via DevPod Desktop Application
Navigate to the 'Workspaces' view and press on the 'More Options' button on the workspace you want to recreate. Then press 'Rebuild' and confirm to rebuild the workspace.
Via DevPod CLI
Run the following command to rebuild an existing workspace:
devpod up my-workspace --recreate
Resetting a workspace
Some scenarios require pulling in the latest changes from a git repository or re-uploading your local folder. If instead of recreating the devcontainer you need to completely restart your workspace from a clean slate, use Reset over Recreate.
** When recreating a workspace, no changes will be preserved! **
Via DevPod Desktop Application
Navigate to the 'Workspaces' view and press on the 'More Options' button on the workspace you want to reset. Then press 'Reset' and confirm.
Via DevPod CLI
Run the following command to reset an existing workspace:
devpod up my-workspace --reset