Coder devcontainer support & extensions

Coder somehow supports devcontainers, but when connecting to the devcontainer with vs code and cursor for example the defined extensions are not installed. It looks like that vs code or cusor do not understand that they are actually not in a devcontainer. Does anyone else ran into the same issue and has a workaround?
15 Replies
Codercord
Codercord2w ago
Codercord
Codercord2w ago
<#1420336493519437855>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Sebo
SeboOP2w ago
GitHub
Support for VS Code Extensions · Issue #68 · coder/envbuilder
The devcontainer spec supports pre-installing VS Code extensions. Could we support this with the code-server CLI (or even the official vscode-server for Remote SSH)? This came up from a prospect at...
Danielle
Danielle2w ago
So coder supports Dev Containers with two approaches: Either with envbuilder or the native devcontainer CLI. Just want to confirm you're using envbuilder and not the devcontainer CLI approach?
Sebo
SeboOP2w ago
@Danielle Thanks for reaching out. We have defined the following
# See https://registry.coder.com/modules/coder/devcontainers-cli
module "devcontainers-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/devcontainers-cli/coder"
agent_id = coder_agent.main.id

# This ensures that the latest non-breaking version of the module gets
# downloaded, you can also pin the module version to prevent breaking
# changes in production.
version = "~> 1.0"
}
# See https://registry.coder.com/modules/coder/devcontainers-cli
module "devcontainers-cli" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/devcontainers-cli/coder"
agent_id = coder_agent.main.id

# This ensures that the latest non-breaking version of the module gets
# downloaded, you can also pin the module version to prevent breaking
# changes in production.
version = "~> 1.0"
}
But cursor shows the following. ssh:... See screenshot and it looks like the extensions are not beeing installed. In addition we can see that we are inside of a devcontainer but the IDE does not seem to pick it up. Does that make sense?
Danielle
Danielle2w ago
How are you connecting to the dev container? Via the Web UI or a different method? If via the Web UI, the "VSCode" button should take you straight into the dev container in VSCode's devcontainer mode
Sebo
SeboOP2w ago
Through the open workspace functionality in vscode/ cursor and there I select first the workspace and then the devcontainer
Danielle
Danielle2w ago
Apologies for the late delay, I think vscode/cursor requires being opened in the same way as any other devcontainer to get the devcontainer functionality
Sebo
SeboOP6d ago
How do I do this? @Danielle I think I managed it. But it is very unpratical since there are a lot of steps involved? Is that something one can configure with a one blick button?
Danielle
Danielle6d ago
Just clicking the "VS Code Desktop" button from the website should work
No description
Sebo
SeboOP6d ago
Ha, how do I add it? Can you share the template? Thanks @Danielle
Danielle
Danielle6d ago
You can see the devcontainer definition we use internally https://github.com/coder/coder/blob/main/.devcontainer/devcontainer.json
GitHub
coder/.devcontainer/devcontainer.json at main · coder/coder
Secure environments for developers and their agents - coder/coder
Danielle
Danielle6d ago
If you're not already seeing the "VS Code Desktop" button you might be on an older version of Coder. It should be there by default for dev containers in the last few versions
Sebo
SeboOP6d ago
@Danielle where can I find the related template that you use for coder/coder?
Danielle
Danielle6d ago
GitHub
coder/dogfood/coder/main.tf at main · coder/coder
Secure environments for developers and their agents - coder/coder

Did you find this page helpful?