mirror of
https://github.com/89luca89/distrobox.git
synced 2026-08-17 16:34:42 -05:00
docs: update documentation regarding VSCode integration (#1996)
* docs: update VSCode integration documentation There are still some problems but it's the best I could test on my own * docs: added a screenshot to better illustrate the process * chore: fix lint errors * fix: typo Co-authored-by: Alessio Biancalana <alessio@dottorblaster.it> * fix: typo Co-authored-by: Alessio Biancalana <alessio@dottorblaster.it> * fix: typo Co-authored-by: Alessio Biancalana <alessio@dottorblaster.it> --------- Co-authored-by: Alessio Biancalana <alessio@dottorblaster.it>
This commit is contained in:
co-authored by
Alessio Biancalana
parent
451cc3cbd0
commit
82ee78ee83
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -15,18 +15,21 @@ VScode doesn't need presentations, and it's a powerful tool for development.
|
||||
You may want to use it, but how to handle the dualism between host and container?
|
||||
|
||||
In this experiment we will use [VSCodium](https://vscodium.com/) as an opensource
|
||||
alternative to VSCode.
|
||||
alternative to VSCode. Dev Containers extension works only
|
||||
for non-opensource version of VS code. There are community made extensions like
|
||||
[DevPod Containers](https://open-vsx.org/extension/3timeslazy/vscodium-devpodcontainers) that work in VSCodium
|
||||
|
||||
Here are a couple of solutions.
|
||||
This guide has become outdated and you will need to expect that some things broke since then.
|
||||
|
||||
## From distrobox
|
||||
|
||||
Well, you could just install VSCode in your Distrobox of choice, and export it!
|
||||
Well, you could just install VSCodium in your Distrobox of choice, and export it!
|
||||
|
||||
For example using an Arch Linux container:
|
||||
For example using an Arch Linux container (We use --home so to not clutter our home directory.
|
||||
You can change it if you have VSCode configuration in your home directory that you like):
|
||||
|
||||
```shell
|
||||
~$ distrobox create --image archlinux:latest --name arch-distrobox
|
||||
~$ distrobox create --image archlinux:latest --name arch-distrobox --home ./devcontainer
|
||||
~$ distrobox enter --name arch-distrobox
|
||||
user@arch-distrobox:~$
|
||||
```
|
||||
@@ -44,6 +47,19 @@ Now that we have installed it, we can export it:
|
||||
user@ubuntu-distrobox:~$ distrobox-export --app code
|
||||
```
|
||||
|
||||
For proprietary version you need to use the binary hosted on [AUR](https://aur.archlinux.org/packages/visual-studio-code-bin).
|
||||
|
||||
To enable and install from AUR do:
|
||||
|
||||
```bash
|
||||
sudo pacman -Syu git base-devel &&\
|
||||
git clone https://aur.archlinux.org/yay.git &&\
|
||||
cd yay &&\
|
||||
makepkg -si &&\
|
||||
yay -S visual-studio-code-bin &&\
|
||||
distrobox-export --app code
|
||||
```
|
||||
|
||||
And that's really it, you'll have VSCode in your app list, and it will run from
|
||||
the Distrobox itself, so it will have access to all the software and tools inside
|
||||
it without problems.
|
||||
@@ -51,6 +67,37 @@ it without problems.
|
||||

|
||||

|
||||
|
||||
### Manage podman from Distrobox
|
||||
|
||||
We will use the
|
||||
[podman-remote](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/building_running_and_managing_containers/using-the-container-tools-api)
|
||||
to manage our containers running on host
|
||||
|
||||
1. Install
|
||||
[Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
|
||||
in VSCode
|
||||
2. Make sure that podman sockets is enabled on the host system
|
||||
`
|
||||
ls -l /run/user/$(id -u)/podman/podman.sock
|
||||
`
|
||||
if it isn't, enable it with:
|
||||
`
|
||||
systemctl --user enable --now podman.socket
|
||||
`
|
||||
3. Inside the Distrobox install podman to provide `podman-remote`
|
||||
`
|
||||
sudo pacman -Syu podman
|
||||
`
|
||||
4. Check if it's working by running:
|
||||
`
|
||||
podman-remote info
|
||||
`
|
||||
5. Configure Dev Containers Extension by putting `podman-remote` in
|
||||
[vscode://settings/dev.containers.dockerPath](vscode://settings/dev.containers.dockerPath)
|
||||
6. If you click refresh in Dev Containers extension you should see your host's containers
|
||||
|
||||

|
||||
|
||||
## From flatpak
|
||||
|
||||
Alternatively you may want to install VSCode on your host. We will explore how
|
||||
@@ -100,10 +147,6 @@ set it to the path of `/home/<your-user>/.local/bin/podman-host` (or docker-host
|
||||
This will give a way to execute host's container manager from within the
|
||||
flatpak app.
|
||||
|
||||
**This works for Distrobox both inside and outside a flatpak**
|
||||
This will act only for containers created with Distrobox, you can still use regular devcontainers
|
||||
without transparently if needed.
|
||||
|
||||
## Final Result
|
||||
|
||||
After that, we're good to go! Open VSCode and Attach to Remote Container:
|
||||
|
||||
Reference in New Issue
Block a user