Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open a project/folder with different devcontainer image #170

Closed
pypeaday opened this issue Feb 27, 2025 · 4 comments
Closed

Open a project/folder with different devcontainer image #170

pypeaday opened this issue Feb 27, 2025 · 4 comments

Comments

@pypeaday
Copy link

This looks like a sweet tool - I am a pretty heavy devcontainer user but not all my projects have a devcontainer configuration/json file. Is it possible to do something like vscli open /path/to/project --devcontainer-image my-image:latest or something like that? Maybe giving the container a name too for some level of persistence?

@michidk
Copy link
Owner

michidk commented Mar 1, 2025

Hey,
that sounds indeed intresting. I think this is something that could be achieved with the --config flag. But to be honest, I couldn't get it to work (see #82). I might have to look into the obfuscated devcontainer code again, trying to figure out how exactly the flag works.

In your request you propose directly linking to an Docker image, but since a devcontainer is always specified by a .json - if I implement this, you would have to link to a json. Or maybe I would automatically create the json for you in some temp directory? Probably not a good idea though.

How are you currently launching your devcontainers though if not all your projects have the devcontainer config? Using the vscode user interface?

@pypeaday
Copy link
Author

pypeaday commented Mar 1, 2025

I use devpod - their pattern is to create a "workspace" from either a .devcontainer.json config file, or else create one just from an image (and if you do this they mount a directory at like ~/.devpod/workspaces/... somewhere in there and that's mounted inside the container at /workspaces/$WORKSPACE_ID. Then devpod launches my IDE and does some configuration magic like for ssh-ing in.
sometimes I also just docker run my devcontainer image and attach via the vs code dev containers extension

@michidk
Copy link
Owner

michidk commented Mar 1, 2025

Interesting. Looking at their source code, it seems like they use the remote containers feature, not actual devcontainers:
https://github.com/loft-sh/devpod/blob/main/pkg/ide/vscode/open.go#L46

So I guess they manage all container aspects themselves and then just connect vscode to their container. That means it's basically a reimplementation of the devcontainers vscode feature. vscli wants to use the devcontainer feature built into vscode - which requires every project to have its own devcontainer configuration.

To support this use-case, we would have to implement our own container management solution (setting them up, starting, stopping etc). I think this is a bit out-of-scope and probably would be a different tool?

However, something similar might be possible with #82.

@pypeaday
Copy link
Author

pypeaday commented Mar 1, 2025

thanks for checking in on it. I'll start adding devcontainer configuration and play around 👍

@pypeaday pypeaday closed this as not planned Won't fix, can't repro, duplicate, stale Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants