[Feature]: Devcontainer integration #6739
Replies: 2 comments
|
I'm with you. I use devcontainers for all my development. This way I can also use github codespaces when needed for quick issues or even using the vscode.dev site. I used to clone the repo into a named volume like you indicate, but found that more of a hassle than a benifit. If I needed to fix a devcontner ar access a file I could just get it direct form the local FS. One thing I have done however is installed opencode directly into the devcontiner and have it setup to share a port to the host. Then from the host I can do a docker exec on the devcontainer and start the opencode server (could do the same for t3 code I expect). Now from the host I can connect opencode to the shared port of the devcontainer. So opencode now sees and operates inside the devcontiner. Now, if this could all be automated by something .. like ... clone a repo to the FS Its the same as having vscode do it, but without running vscode. |
|
We run T3 Code against dev containers from laptops to Linux box on a tailnet with repos whose toolchain only exists in the container. What works is the inverse of "connect the host server to a container": run the T3 server inside the dev container, since the server is already T3's execution boundary: terminals, git, worktrees and agent processes all execute wherever One long-lived container per repository (not per worktree), brought up with the devcontainer up --workspace-folder "$repo" \
--mount "type=bind,source=$HOME/.t3/$name,target=$HOME/.t3/$name" \
--remote-env "T3CODE_HOME=$HOME/.t3/$name"
devcontainer exec --workspace-folder "$repo" --remote-env "T3CODE_HOME=$HOME/.t3/$name" \
npx --yes t3@latest serve --tailscale-serve --no-browserA few things that make it work:
The rough edges we hit, in case they're useful as small fixes:
The feature: a dev container feature that runs the T3 serverThe remaining manual step is starting the server, and the dev container spec already has the right hook: a feature can declare an
That leaves the host-side tooling at In this meantime, this little |
Uh oh!
There was an error while loading. Please reload this page.
Before submitting
Area
Not sure
Problem or use case
I prefer to code in a devcontainer. It makes sure that I have a running environment with all my needed dependencies and tools ready to go. Further still, in VS Code, I'm able to clone a GitHub repository into a docker volume, significantly reducing the trade-offs from mounting a Mac filesystem, and totally isolating the devcontainer from the host filesystem. This allows things like bun and uv to work much more effectively than with bind mounts.
But no harness or harness interface supports helping me manage devcontainers for projects. I think it would be a massive up-level for working with multiple agents if each one was working in a separate, isolated devcontainer, in a totally separate git clone, ready to have all of its dependencies manipulated, other apps installed if needed, and every backing service, like postgresql and redis, able to be given a dedicated clean environment that no other.
Proposed solution
When starting a new agent, I'd like to be able to choose a git or GitHub repository to clone into a docker volume, and when cloned to have it allow me to choose which devcontainer to launch (multiple devcontainers are permitted in the same repo) against that volume as the mount for the app working directory.
Why this matters
This deep isolation can make agents much more independent and capable, because they will have a non-conflicting environment that has all fresh dependencies. It can also pave a clearer path for fully-operation cloud agents.
Smallest useful scope
A smaller useful scope might be to have tools that can be devcontainer-aware. But that sounds like a harness problem, so likely outside the scope of T3 Code.
It feels like the isolated docker volume + devcontainer set up may be the minimal scope here.
Alternatives considered
Worktrees give some reasonable part of the benefit, but fall short of the isolation that devcontainers give. Worktrees clash with each other (branches can only be check out in one worktree). You can install packages separately, but typically won't have isolated database, etc, so the agent isn't starting from a clean environment. Plus, they are running on the host, so if the application is not developed to run cross-platform with the host OS (most devcontainers are Linux, many hosts are Mac), you end up needing to solve that problem before you can use them effectively.
Risks or tradeoffs
The biggest hurdles I see are:
Examples or references
Contribution
All reactions