#How can we spin up dev container from dagger? Please help to write a step by step blog
1 messages · Page 1 of 1 (latest)
you can spin up devcontainers with Dagger. There's a caveat though which is that Dagger doesn't allow yet to bind mount files in your machine to the container
so you'll have to restart the devcontainer each time yoi make changes to your files
it's not the ideal flow, but something that we'll eventually want to enable
any ETA?
@patent hamlet any ETA bro?
Hey! There's no ETA for this.
@patent hamlet is this possible now with dagger 0.10 release?
hey! no, not possible yet. You can still do it, but it has the same caveats that I mentioned above
the code that you modify in the devcontainer won't be automatically synced to your local machine
We don't want to sync it with a local machine we just want to push it to github repo once work is done that's the only requirement from dev container, so can you please guide for it?
@crude vortex - It might not be exactly what you are looking for, but I figured I'd throw it in here as a possibility. We are using Coder successfully for a while now for what they call CDEs or cloud development environments. Maybe it is what you are looking for?
thanks a lot for helping.
i am aware of coders and such tools but we want to build with only dagger and dont want to use any other things as dependency. so our team is reserching how we can migrate to dagger only dev and cicd workflow
we will be able to keep modified code files till we turn down dev container or kill container through dagger?
yes, you can export the modified files to your local machine before shuttind down the environment
where are you planning to pull the code for the dev environment?
also, what do you expect this dev environments to contain?
are you planning to provide a remote VSCode or something so developers can edit the code in the editor?
what's the workflow that you have in your mind?
we just want to spin up dev container through the dagger and want to develop in that container and once work done we want to stop or kill that container, currently in local machine...other part we will take later in enhancement and basically we want to replace docker in our devops workflow with dagger for any end to end work...we dont want to write docker files or compose yml files, that's it
Please HELP
@patent hamlet one part I'm not sure about, is IDE integration. What's the standard way for IDE to integrate with a devcontainer? Can I configure say, VSCode or Zed so that it's transparently editing files in the contaner, and when it opens a terminal, that terminal is in the container? That's the experience I would want, but I have a feeling that reality is not so seamless...
for VSCode AFAIK the integration is seamless given that as long as I can expose a TCP port to the host I can attach the VScode client and everything works out of the box. Not sure if Zed has the same model though.
What's the protocol behind that TCP port?
not sure, haven't checked what underlying transport it uses
Ah well that answers my question, it' s a vscode-specific server protocol
One part that will be painful, is that VSCode remote works by airdropping binaries into the remote server in a very ugly way
I expect it doesn't work well with ultra-ephemeral containers, because VSCode will just reinstall everything each time, which will be slow
it's quite nice because it also multiplexes other ports over the same transport. So if you run something in your dagger container, you can still access it via localhost in your machine
well.. I guess we can:
- use a cache volume
- try to pre-install those binaries beforehand as part of the module
yeah that could work
The other approach is devcontainers: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
But then that's tied to calling docker I guess
devcontainers is basically a spec over the vscode transfer protocol
Yes but it's also a specific implementation in a VSCode extension, which has a hardcoded dependency on the docker CLI I think
--> This extension https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers
yes, correct
I'd assume there's something in the spec where you can say: "don't provision the server, just connect to this port".. but we'll need to check
Eventually would it make sense to fork the devcontainers extension, and make a Dagger-compatible one? Or even contribute dagger support to the upstream extension?
Not looking good 👆 (for preinstall)
But cache volume could work
@patent hamlet I think the options for integrating with VSCode boil down to 3 possible entrypoints:
- SSH (via Remote/SSH extension)
- Docker CLI (via Devcontainers extension)
- Dagger CLI (requires forking the devcontainers extension)
This is exactly what Coder does (among other things). And it isn't simple to do AFAIK (otherwise Coder wouldn't be a thing, right?). Coder sets up a tunnel over HTTPS so that VSCode or other IDEs can communication via SSH within the container (using tailscale). Terminal connection is also included, but over Coder's tunnel.
@lone hare @patent hamlet first of all thank you so much for taking consideration of this idea and showing serious efforts in this direction, yes after spinning up container we can connect it with vs code via vs code remote container or ssh feature of vs code extensions, so we are very close...we don't require to much things to implement to achieve this...please keep this efforts on and help me to write a blog for dagger.
which can remove the dependency of docker eventually.
any update for this vision?
@lone hare any steps required from my side?
@lone hare can't we use this so we can have url also in browser for dev https://code.visualstudio.com/docs/remote/vscode-server
can running cli command forwarded to dagger and then to cli to get that running url and get auth with it?
@lone hare @patent hamlet are we there yet?
@lone hare can we achieve similar functionality of https://devpod.sh/ with dagger function capabilities without using devpod?
@crude vortex no, Dagger does not replace devpod. It's possible to implement a devpod equivalent on top of Dagger primitives, as discussed in this post. But that is not something we (the core Dagger developers) are focused on. If you decide to work on this yourself, we will be happy to support you by answering your questions. But unless you or someone else in the community decides to invest their own time, it will not happen on its own. Please stop asking.