Ask HN: 如何设置 MicroVM 以实现类似 VS Code Dev Container 的体验?

1作者: Erndob3 个月前
我目前的设置是在本地运行的开发容器中进行所有开发工作。<p>我打开 VS Code,在开发容器中打开本地文件夹。本地文件夹被挂载到容器中以实现持久化更改。容器的 Dockerfile 定义了我的开发依赖项。在容器内,我可以进行任何我想要的全局安装,这些安装在会话之间保持不变,并且项目编辑会保留在宿主机上。<p>这种方式运行良好,我很喜欢这种设置。我可以在 VS Code 的终端中运行 CLI 代码代理,同时仍然拥有良好的开发体验。<p>现在,我希望基本实现相同的流程,但基于 MicroVM,我主要解决的问题是允许我在该 MicroVM 内部运行 Docker,因为 Docker-in-Docker 效果不佳。此外,如果我可以在 MicroVM 本身不暴露密钥的情况下使用密钥,那就太棒了。<p>但我花了很多时间研究不同的 MicroVM,存在一些问题:<p>- 很多 MicroVM 专为短时、短暂的任务而设计,而不是一个可以轻松持久化、并且容器持久化和宿主机持久化分离的长期运行的开发环境。<p>- 我认为它们没有与 VS Code 或其他开发工具集成?难道需要在 MicroVM 本身安装 VS Code,而不是让宿主机的 VS Code 与其交互?<p>- Docker 发布了沙盒,它在某种程度上满足了我的需求,但它仅限于 AI 代理。而且只能使用他们支持的那些。你不能拥有自己的自定义环境,在那里做你想做的事情。<p>所以我很困惑。有很多不同的解决方案,但似乎没有一个能用,我只想拥有类似 Dev-Container 的体验,更安全一些,并且允许我在其中运行 Docker。
查看原文
My current setup is just doing my entire development in a dev container that is running locally.<p>I open VS Code, I open the local folder in a dev container. The local folder gets mounted into container for persistent changes. The container dockerfile is my setup of dev dependencies. Within the container I can do whatever global installs I want that persist between sessions, and the project edits persist on host machine.<p>That works and I like the setup. I can run CLI codent agent in the terminal of VS Code, while still having good dev experience.<p>Now, I would like to have basically this flow but be MicroVM based, where the main thing I solve is allowing me to run docker inside that microvm, as docker-in-docker does not work well. Additionally if I could use secrets without them being exposed in the microvm itself, that would be amazing.<p>But I&#x27;ve spent a good amount of time checking different microvm&#x27;s, and there&#x27;s a few issues:<p>- A lot of them are designed for short ephemeral tasks, not a long running dev environment that easily persists and has separation of container persistence and host persistence<p>- I don&#x27;t think they integrate with VS Code or other dev tools? Are you supposed to install vs code into the microVM itself, instead of having host VS Code interact with it?<p>- Docker released sandboxes which kinda does what I need, but it is JUST ai agents. And only the ones they support. You can&#x27;t have your own custom environment where you do what you want.<p>So I am confused. There&#x27;s tons of different solutions and none of them seem to work, all I want is to have Dev-Container like experience that is a bit more secure and can allow me to do Docker inside of it.