Image by Lara Far (https://unsplash.com/@lara_far)

Spinning up a temporary desktop environment within GitHub Codespaces

Aymen Furter
2 min readAug 31, 2022

--

As developers, we are always looking for ways to be more productive. An iPad with Github Codespaces is a great developer experience. The iPad is portable so it can be taken anywhere.

I was skeptical at first, but after using it for a while, I was convinced that it was a great way to develop software independent of location. Now, I use Github codespaces for everything. Building User Interfaces using Typescript and Angular, Writing Microservices using Java, and even selenium-based automation. It has really helped me to streamline my work and get things done faster. Furthermore, I recommend this setup for developers who want to get work done while they’re away from their desktops.

Inside GitHub Codespaces, you use devcontainers to create and test your code. This allows you to package your code faster later on since you already know how to containerize it.

In this blog post, I will show you how to spin up a full desktop environment within GitHub codespaces!

A webtop docker container is a great way to get a desktop environment within GitHub codespaces. It is based on Apache Guacamole. All you need to do is pull the image from Docker Hub and then run it with a single command:

docker run -d \
— name=webtop \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/London \
-p 3000:3000 \
-v /path/to/data:/config \
— shm-size=”1gb” \
— restart unless-stopped \
ghcr.io/linuxserver/webtop

Once you have the webtop docker container up and running, you will have it available to you secured through GitHub. You can use all of the same tools that you would use on your local machine, without having to worry about traveling with a laptop.

Keep in mind that the webtop docker container does not persist data. This means that any changes you make to files within the container will be lost when you exit the container. If you need to save any data, you will need to mount a volume from your local machine into the container. You could for instance replace the /path/to/data path above, pointing to your git directory instead.

--

--

Aymen Furter

I am a Cloud Solution Architect working for Microsoft. The views expressed on this site are mine alone and do not necessarily reflect the views of my employer.