Visual Studio Code is one of my favorite development tools when it comes to coding projects. It’s versatile, easy to use, and has a tremendous amount of community support. It’s one of the first things I install on any computer and I spend a ton of time using it to manage scripts I’ve written to help automate my workflows and server maintenance tasks.
You can imagine, then, how excited I was when I discovered code-server, a containerized version of Visual Studio Code that can be installed on any Linux-based device and accessed through a web browser.
For me, this is useful for a number of reasons:
- I no longer need to reinstall the application and reconfigure my settings on every device I own (although official settings sync support is coming soon and similar extensions can be found in the marketplace)
- I can write code on my laptop while leveraging my server’s hardware resources
- I can manage my projects in a Linux environment, even from my non-Linux devices (and yes, I have leveraged Visual Studio Code via WSL before)
The guide below provides a basic walkthrough of how to get code-server up and running on Unraid. If you’re using another flavor of Linux, the GitHub repository contains easy Docker setup instructions should you want to install it on a different system instead.
Installing Code-Server Through Community Applications
Like most applications, we can find code-server using the Community Applications plugin in Unraid.
Navigate to the the “Apps” tab and search for ‘code-server’. Install the only container that appears:
From there, the installation options are fairly straight forward:
- Choose a port to use when accessing the application from the web interface
- Set a password to access the web interface
- Set a password for sudo access within the application
If you’d like to have access to any of your Unraid shares from within Visual Studio Code, go ahead and create a custom path now. I use it to manage some of the files in my “Downloads” share, so I’ve mapped it as follows:
Before we click ‘Apply’ and install the container, you may need to install a Docker mod depending on what you’re going to be using Visual Studio Code for.
In my instance, I’d like access to utilize Python within the container. Despite the fact that I’ve already installed Python3 in Unraid using the NerdPack plugin, it will not carry into my code-server instance because it’s a new container.
We’ll utilize Docker mods to add a command to install Python (or your mod of choice) when the container starts so we can utilize it when we open the application. Using the instructions found for Python3 on this page, I’ve created a new environmental variable that looks like this:
Replace the “Name” and “Value” fields using the snippets given from the Docker mods page if you’re installing something other than Python.
Once you’re finished, hit ‘Apply’ and install the container.
Initial Boot Time
If you’re installing a Docker mod along with the container, the very first time the container starts it may take 10-15 minutes to become available from the web interface due to the amount of time it takes to install that particular mod.
This should only happen the first time you install a mod and subsequent boot times should be considerably shorter.
If you have concerns, check the logs of the container to monitor the application’s status if it’s taking longer than anticipated to start.
Remote Access to Visual Studio Code
If you followed the above steps, you should now be able to access your instance of Visual Studio Code using the web interface and the port you assigned at installation.
You can now access it from any device within your internal network.
If you’d like to access it from outside your network, you have several options:
- Use a VPN service (I recommend WireGuard) to connect to your internal network from an external device and use your server’s internal IP address and the application port number to access the web interface
- Set up a reverse proxy (using a custom domain on free DNS service like Duck DNS) and access the web interface from a subdomain on any external network without the need for a VPN
If you choose to set up a reverse proxy, I cannot stress how important it is to create secure credentials to access the application, especially if you plan to grant it access to your GitHub repositories.
That should be it – you should now have access to Visual Studio Code from almost any device that has an internet connection.
Feel free to ask any questions or leave feedback in the comments below.
If you’ve found this or any of the other posts on SHIFT14 helpful, please consider supporting the site through a one-time PayPal donation or ongoing support through Patreon. My goal is to continue providing in-depth guides for the technical community and the support helps justify the time and resources spent doing so.