When it comes to my system, everything gets put into docker containers for easy to destroy environments when they are no longer needed. I have always hated bloating up my main workstation with packages and dependencies for projects that are only going to last me a few weeks. That is why I set out to find a way to run vscode in a lightweight style from docker.
I stumbled upon an existing project (https://github.com/alexanderdna/container-tunnel) which had what I needed, but achieved this using the tunnels feature, VSCode's new way of remote development. You can access your tunnel from the VSCode editor or event vscode.dev website.
I forked this project and was able to clean it up a bit and published it publicly under domkalan/vscode-tunnel on GitHub. The Docker image is based on Debian Bookworm which is the latest Debian version as of publishing.
Try it yourself
For more information, view the project’s GitHub page with detailed setup instructions. Or, get started by running this on your server with Docker installed:
docker run -d --name vscode-tunnel \
-v /opt/vscode/projects:/home/workspace
--network host --restart always --workdir /home/workspace \
domkalan/vscode-tunnel:latest
Once the container is running, you will need to register the tunnel to your GitHub account. View the logs from tunnel to view the steps on how to register.
docker logs vscode-tunnel
You should see something like this in your terminal.
*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
[2023-11-07 23:53:58] info Using Github for authentication, run `code tunnel user login --provider <provider>` option to change this.
To grant access to the server, please log into https://github.com/login/device and use code XXXX-0000
[2023-11-07 23:56:56] info Creating tunnel with the name: vscode-tunnel
Top comments (0)