Use Native VSCode in Distrobox Container?

Is there a way to open VSCode in a disrobox container? I mean the one that is layered into Bluefin itself, rather than reinstalling VSCode inside the container?

I am working with someone on a Go project and they are using 1.23.4 which appears to be a more recent version than I can get through a VSCode devcontainer, more recent than is available via Homebrew, etc. But my Arch Distrobox has it in the repos!

What I would love to do is to essentially replicate the workflow that I use at work. We are a Windows shop (I know…) but I do all my development in WSL2 in the latest Ubuntu LTS since the apps will run in Ubuntu containers in Azure. In Windows, you can attach VSCode to WSL - run VSCode on the host OS and edit files and run the code locally in Linux.

Is that possible with Distrobox? Or would I have to essentially install VSCode in the Arch Distrobox? I kind of don’t want to have multiple installations of VSCode kicking around but…

Ordinarily, you would install newer-than-the-repos versions of Go by downloading the tarball and extracting it in /usr/local.

Wait… Is /usr read only? I am having trouble keeping track of the directories in root that I can actually do something with and which ones I can’t…

Anyway, I appreciate any advice on this topic!

There’s a previous post on here with a guide on how to do this. Essentially, VSCode can attach to distroboxes the same way as with devcontainers.

One thing to note is that you need to have that json config in there before attaching to your distrobox, otherwise it will mess with your git config and won’t play nicely if you have multiple distroboxes in the same home.

1 Like

Thanks for the link! My search was… probably ill formed and I did not find that topic. I’ll read up on it and see if I can make the magic happen.

Also AFAIK, /usr is the only immutable directory on Bluefin, Silverblue, etc. that isn’t immutable in Fedora Linux. As long as it’s not in /usr or symlinked to /usr you can treat stuff like any other Linux distro.

The only “exception” to this however is anything that symlinks out of /usr to somewhere in /var, such as /usr/local and /usr/tmp.

1 Like