Visual Studio Code Server container setup
Introduction
Code-server is Visual Studio Code running on a remote server, accessible through the browser.
Since I use Visual Code Server to edit yaml files of Home Assistant I have created a volume mapping to the config
folder of Home Assistant.
Setup
-
Create the folders needed by the container
Run the following commands inside your home folder:
-
Create the script needed to run the container
Save the following script as
codeserver_run.sh
:Instructions:
- Optional Replace
docker
withpodman
if needed - Required Replace port number
8833
(on the left side of:
) with a port number that is available if needed. - Optional Replace
$PWD/config
with the location of your configuration if needed. This can be a fileserver mount - Required Replace
<linux-username>
with your own username if you want to create a mapping to a location with files you want to edit with code server. In this example it is the configuration folder of Home Assistant. This will only work if this container is on the same machine as your Home Assistant instance. So you can remove the whole line if you do not use this mapping - Required Replace
Europe/Amsterdam
with your own timezone
- Optional Replace
-
Run the script to create the container
Run the following command:
The image
linuxserver/code-server
is automatically pulled and the container is created. -
Check the results
If needed you can check if the container is running properly.
Now you can use Visual Studio Code Server by opening a web browser and going to:
http://localhost:8833
. Replace localhost with the relevant IP address or FQDN if needed, and adjust the port if you changed it earlier.To use the mapping to the Home Assistant configuration map go to
File
andOpen Folder...
, empty the command palette and type/homeassistant
and pressEnter
. Now it is possible to edit the yaml files of Home Assistant.
No comments found for this note.
Join the discussion for this note on Github. Comments appear on this page instantly.