Live data from Hacker News

Switching to Claude Code and VSCode Inside Docker

timsh.org

41–50 of 170 posts

Re: Switching to Claude Code and VSCode Inside Docker

#41
post #26

I use DevPod [1] to run Claude Code within Docker-based dev container environments, and it's been fairly seamless. It lets me run environments locally and focus Claude's context on just the repo I want it to work on. [1]: https://devpod.sh/

Bluefin distro is container/isolation oriented (sort of required given the immutable nature and not wanting to do too much layering) and includes a lot of options to implement a dev environment, including devpod and distrobox/toolbox.

https://docs.projectbluefin.io/bluefin-dx/

Another idea is to develop in a KASM rootless docker workspace, where distrobox/toolbx can also be at your disposal. KASM workspaces are accessible thru the web, so you can work from anywhere.

The immutable nature of ideas like Bluefin and KASM encourage the user to use brew for package management, which would stay persistent under /home/linuxbrew

https://hub.docker.com/r/linuxserver/kasm

https://kasmweb.com/docs/latest/how_to/docker_in_kasm.html

https://gist.github.com/jgbrwn/28645fcf4ac5a4176f715a6f9b170...

Re: Switching to Claude Code and VSCode Inside Docker

#42

Yes please, more containers-first thinking for all things AI. The fact that this has been largely absent from most discussions and demos regarding agents and vibe-coding seems like a big red flag to me. I mean if we're going to YOLO the code, perhaps we should at least pay some attention to the dev / test harness? It's worth thinking about reproducibility even if you're not concerned about security. We would not have…

Containers bring their own set of problems, there are some examples brought up in this thread, mainly around communication with the host OS.

I‘d argue the reproducible parts of vibe coding (agentic engineering) setups are just text files. Many people use a mix of web apps (AI studio), Mac apps (Wispr Flow), and other UI tools (repo prompt) in their workflow which can’t be put in a container anyway - well, reasonably at least.

If you want security, containers won’t get you that far. You’ll need to use a VM.

But if you give Claude Code access to your GitHub repo, what else is there worth protecting, that’s not protected by keychain & sudo?

Re: Switching to Claude Code and VSCode Inside Docker

#43
post #38

I have enjoyed running Claude Code in a container. The biggest advantage for me isn't security though, it's how easy it becomes to spin off agents to work in the background. I use a simple script that copies my working directory into a container, prompts Claude Code, and then either saves a planning document locally, or opens a pull request in GitHub for me to review. I quite like this because it makes starting agent…

Have you tried setting up multiple git worktrees as well? I wonder if that doesn’t solve most of the issues.

I have, but I just found that a bit tedious to manage manually. Maybe another version of this script would just be to automatically create a worktree, run a prompt in that, and then have the script manage the results, and clean up the worktree at the end.

Re: Switching to Claude Code and VSCode Inside Docker

#44
post #33

If you are using Claude Code on macOS running it in a devcontainer has a few upsides like fewer cli tool call failures, meaning less waiting time and less context window spam. But there are some things you lose as well @ ergonomics: - "done" notifications are not working by default (might be possible trigger and send to host using hooks feature) - more difficult to give playwright a session (need to get cookies into…

I never have tool calls failing on macOS. What tool calls are failing for you?

Re: Switching to Claude Code and VSCode Inside Docker

#45
post #31

2-ish questions: Is this level of fear typical or reasonable? If so, why doesn’t Anthropic / AI code gen providers offer this type of service? Hard to believe Anthropic is not secure in some sense — like what if Claude Code is already inside some container-like thing? Is it actually true that Claude cannot bust out of the container?

> Is this level of fear typical or reasonable? Just a month ago, an AI coding agent deleted all the files on someone's computer and there was a little discussion of it here on HN. Support's response was basically "yeah, this happens sometimes". forum post: https://forum.cursor.com/t/cursor-yolo-deleted-everything-in... HN thread (flagged, probably because it was a link to some crappy website that restates things from…

It's worth noting that the default settings of Cursor do prevent this by asking you to confirm every command that is run. And when you get tired of that 5 minutes in and switch to auto-approving there is still protection against files outside the work directory being deleted. The story above is about someone who disabled all the safeguards because they were inconvenient, then bad things happened

It is a good example of "bad things can happen", but when talking about whether we need additional safeguards the lessons are less clear. And while I'm not as familiar with the safeguards of Claude Code I'm assured it also has some by default

Re: Switching to Claude Code and VSCode Inside Docker

#47
post #24

2-ish questions: Is this level of fear typical or reasonable? If so, why doesn’t Anthropic / AI code gen providers offer this type of service? Hard to believe Anthropic is not secure in some sense — like what if Claude Code is already inside some container-like thing? Is it actually true that Claude cannot bust out of the container?

I have personally never seen claude (or actually any AI agent) do anything that could not be fixed with git. I run 24/7 in full permissions bypass mode and hardly think about it.

Correlation does not equal causation as the old adage goes. Just because if you havent seen the pattern, doesn't mean it can't.

It is like insurance, 99.95% of the time you don't need it. But when you do, you wish you had it.

Re: Switching to Claude Code and VSCode Inside Docker

#48
Another advantage of running claude inside a container is that you can use "--dangerously-skip-permissions" and let it do a thing in full autonomy for 2 hours. With a good prompt, abundant feedback like centralized logging and tests and a clear Claude.md, it can get pretty far on its own.

Re: Switching to Claude Code and VSCode Inside Docker

#49

How can I preserve the local configuration files I have with this container? (the custom slash commands, config.json etc)

Mount them to the local filesystem, maybe even as read-only so Claude cannot modify them.

It actually makes bootstrapping the dev env so much easier too, basically just take a template .devcontainers and you're golden. After that just tell Claude what files you want to mount to the filesystem and restart

Re: Switching to Claude Code and VSCode Inside Docker

#50
I have actually been working on something similar but instead of Docker, I am using Apple’s builtin container[1] support to run shell commands and code with real OS-level isolation. It’s fast (spawns in milliseconds) and integrates nicely with things like Claude Code and the Gemini CLI. I open sourced it as CodeRunner[2]. Would love to hear what people think or chat about how it compares.

1. Apple container: https://github.com/apple/container

2. CodeRunner: https://github.com/BandarLabs/coderunner

Caveat: You need M1/M2/M3/M4 mac for this to work. MacOS 26 is optional but recommended.

Post reply on HN