Install vscode (visual studio code) as a separate docker container

Works like a charm now :slight_smile:

Hi,
Which container do you use for VSCode?
Using VSCode on Synology registry, I find tons of versions
Your help will be appreciated, thanks

Is is codercom/code-server?

no, its linuxserver/code-server

1 Like

How do I get a HA side panel working ? Can you please provide your config for that. Thanks

Thanks for your guide.

I only have one problem:
I’m trying to install those VSIX files but every time I install one it only says:
“Please reload Visual Studio Code to complete installing the extension Python.”

And the actual extension doesn’t get installed.
I already tried restarting and refreshing everything but it just doesn’t work.
Any ideas?

Thanks a lot.

Hi hello

thanks

but i dont know why, cant connect do VS vis ip: 8443

i do have this in log :

standard_init_linux.go:211: exec user process caused "exec format error"

Thanks in advance

In your configuration.yaml file do this

panel_iframe:
vscode:
title: ‘VisualCode’
url: 'http://IPOFVSCODECONTAINER(HA):8443
icon: mdi:visual-studio-code

6 Likes

Solved it and wrote the following comment elsewhere:

Notice that the docker file is automatically installed for amd64 architectures. If you have an arm64 system you’ll get “standard_init_linux.go:211: exec user process caused “exec format error””. The repo also had a problem with fixuid which was not supporting arm64 until the latest revision. I’ve got this to work with the very latest rc. Simply change the last part of docker run call to codercom/code-server:3.3.0-rc.7-arm64 and make sure to check the current releases for the latest (ideally officially stable) version https://hub.docker.com/r/codercom/code-server/tags

All went well until i finally reloaded HA . the VScode item is on the panel on lft, clicking it opens vscode in the iframe and it asks for a password. it will not accept the password - which works fine when i go to the vscode container from the host (ubuntu)

I’m also getting that

Hi guys,
In case someone would need that. Instead of searching for the package names in the marketplace search them by their display name (in this case no need to download vsix file):

Log File Highlighter” = emilast.LogFileHighlighter
ESPHome VSCode” = ESPHome.esphome-vscode
Home Assistant Config Helper” = keesschollaart.vscode-home-assistant
Material Design Icons Intellisense” = lukas-tr.materialdesignicons-intellisense
indent-rainbow” = oderwat.indent-rainbow
YAML” or “YAML Language Support by Red Hat” = redhat.vscode-yaml
Error Lens” = usernamehw.errorlens
vscode-icons” = vscode-icons-team.vscode-icons

Good luck,
Dmitry

14 Likes

I’d like to have this too, is this any setup instructions? Thanks.

The cool thing about using a linuxserver image is that it is already set up to support docker-mods. You simply add a DOCKER_MODS environment variable with a list of the mods you want to apply and start it up.

I made one to add the HA specific add-ons. So you can do something like:

docker run --name vscode -d -p 8443:8443 -v /vscode:/config -v /path_to_hass_config_folder:/config/workspace -e DOCKER_MODS=stecky/mods:code-server-home-assistant -e HOMEASSISTANT_URL=http://localhost:8123 -e HOMEASSISTANT_TOKEN=put_your_long_lived_access_token_here linuxserver/code-server

Check the logs to see when it finishes starting up (it will take a minute or two the first time it starts up) and then launch http://localhost:8443 in your browser.

Done… easy peasy

3 Likes

Thanks for the code, that has saved me loads of searching and it works great. I did have to change ‘config/workspace’ to ‘/ha_config’ on your script to get it to work.

3 Likes

Cool… Glad it worked out for you.

Thanks for the code and also for the hint about using the Docker-mod. Works like a charm on my raspberryPi 3B+…Thanks for the good work.

@stecky could you please share the source of your Docker-mod? Mainly out of interest on how to create such a mod and to perform some maintenance in the future

Here you go: https://github.com/stecky/docker-mods/tree/code-server-home-assistant

Thanks for the mod. There is a problem with it though, when using this mod it invalidates the PASSWORD arg, meaning when using this mod vscode doesn’t ask for a password anymore when you connect to it.

Is there a way to make both work?

would be interested in this as well.

My workaround now:
What I do is point my reverse proxy also to that codeserver container, and I log in directly on it.
Then I should disable the reverse proxy redirect (but I’m lazy)
Then it keeps that cookie for ages and you’re all set.

1 Like