Replies: 8 comments 8 replies
-
For me, VSCode was installed as a flatpak. Here's how I set it up. Running outside the container was motivated by being able to use my GPU for machine learning. This never worked out running |
Beta Was this translation helpful? Give feedback.
-
I'm taking a stab at playing with this with code layered + devcontainers and then a convenience tool like devbox or devpod. |
Beta Was this translation helpful? Give feedback.
-
Yesterday I tested the development in flutter. I couldn't get it access to Chrome yet. Otherwise having VSCode installed via Flatpak works after a bunch of tweaks (so container involved here). |
Beta Was this translation helpful? Give feedback.
-
I've been testing multiple VS Code setups on my machine, and so far the one I find the least annoying is just using an Arch Distrobox and installing everything inside there. That includes my Slack, Postman, VS Code, Google Chrome, SDKs (Node.js, Flutter, Deno, python, etc). I don't really make use of my GPU since I don't do ML, but (maybe) an image that comes with stuff preinstalled could be a solution for some devs. I also tested the flatpak and integrating it with that same Arch Distrobox, but it had some “fun” quirks like running as root inside the container, and after trying to figure out what was going on I just gave up. Perhaps someone else with more braincells than I can configure it easily, but I just couldn't. |
Beta Was this translation helpful? Give feedback.
-
As requested by @castrojo; my setup revolves around using the VS Code flatpak on my base OS (Kinoite) where I then leverage the remote containers extension to develop inside distrobox containers, thus avoiding having many installations of VS Code within each development container. However, while distrobox uses your base's user, the extension uses the root user by default. This means if you use the remote containers UI to connect to a running container it'll run as root, meaning anything you do in your homefolder (as mounted by distrobox) will get fubar permissions. The devcontainer spec does accommodate a configurable
There you will find a few folders that contain devcontainer files made by VS Code from your usage of the remote containers GUI. The one of interest for me was Adding a {
"remoteUser": "superman",
"workspaceFolder": "/home/superman/foo",
"extensions": [
"bungcip.better-toml",
"ms-vscode.cpptools",
"rust-lang.rust-analyzer",
"vadimcn.vscode-lldb",
"VisualStudioExptTeam.intellicode-api-usage-examples",
"VisualStudioExptTeam.vscodeintellicode"
]
} Unfortunately this option doesn't appear to be configurable anywhere in the VS Code settings. I'd also like to be able to ditch the proprietary VS Code build in favour of VSCodium but the remote containers extension prohibits this at present (another reason to move to neovim when I have the time I guess). |
Beta Was this translation helpful? Give feedback.
-
I've figured out a neat way to script the launch of podman containers on VS Code startup - like explainshell, which is a dependency of the Bash IDE extension. Incidentally, this technique should theoretically work for any Flatpak that has an extension/plugin installed within it that requires something else to be started - it's not limited to VS Code, or to containers. Unfortunately I haven't yet figured out how to shut them down on VS Code shutdown yet, but it's something. |
Beta Was this translation helpful? Give feedback.
-
This is my approach for making devcontainers work with VSCode Flatpak + Podman:
[containers]
env = ["BUILDAH_FORMAT=docker"]
label = false
userns = "keep-id"
flatpak override --filesystem=/tmp com.visualstudio.code Previously posted at https://discussion.fedoraproject.org/t/vscode-devcontainers/45874 |
Beta Was this translation helpful? Give feedback.
-
My approach nowadays is installing and configuring all shell bling and code editors with home-manager. |
Beta Was this translation helpful? Give feedback.
-
(This is labelled as a
concept
, which is an inprogress idea or proposal, it is not resourced or scoped so mostly just a collection of ideas. Over time it might move to aproposal
)We need to figure out how to connect VSCode to containers, set up devcontainers in
podman
, and all of that stuff.I'm aware that some people install VSCode's GUI inside a distrobox and "export" the shortcut to the host, but apparently that has limitations with file permissions (according to a comment in the tracking ticket).
I am aware that VSCode as a Flatpak was terrible in the past (very limited), but I've been seeing recent articles where people happily use it via "remote container" extensions. Apparently it can run build tools inside podman containers very easily. If anyone's able to help with insights about that, please share your experiences regarding the setup and limitations of that.
It would be optimal if we're able to have a nice VSCode experience while running it as a Flatpak, rather than having to layer a native package or creating a distrobox.
The VSCode Flatpak definitely looks great. It is very actively maintained, 308 commits and has automatic updates of upstream and libraries:
https://github.com/flathub/com.visualstudio.code
Here are various articles about VSCode remote container solutions:
https://code.visualstudio.com/docs/devcontainers/containers
https://developers.redhat.com/articles/2023/02/14/remote-container-development-vs-code-and-podman
https://marketplace.visualstudio.com/search?term=containers&target=VSCode&category=All%20categories&sortBy=Relevance
This needs to be figured out, since a lot of people want VSCode, but we definitely can't layer VSCode natively in the main images, since only developers want IDEs. We therefore need to figure out the container workflow, so that we can write docs to help our users (and ourselves) use VSCode as a Flatpak, without natively layering it anymore.
As a high level summary, the way I understand it is that the container workflows are like this:
There's definitely more to it, such as how to access local files... do they all have to be accessible from inside the container already, to be able to open them in VSCode when connected to a container?
And what would happen with the excellent "VSCode NeoVim" extension which uses
neovim
internally to support Vim motion in VSCode? That extension may not work in this workflow (if the "files" live remotely), which I'd be okay with though, since there's a few extensions that implement most of the important Vim motions natively in Javascript in VSCode instead: https://marketplace.visualstudio.com/search?term=vim&target=VSCode&category=All%20categories&sortBy=RelevanceBeta Was this translation helpful? Give feedback.
All reactions