Webtop: Run a Linux Desktop in Your Browser with a Lightweight Docker Container
Video
Transcript
Hello, this is channel Easy Self Host.
In this video, we are going to run Webtop by LinuxServer.io.
Webtop is a Linux Desktop running inside a Docker container and accessible via web browsers.
Webtop lets you do all kinds of desktop stuff inside a browser tab.
It’s isolated, so it won’t produce any footprint on your personal computer.
And you can access the same desktop across different devices.
You can easily dispose of a session by just bringing down the container, and all of your data will be deleted.
It’s also lightweight, so it can be started within seconds.
Now let’s start running our Webtop with Docker Compose.
The Docker Compose file here is originated from the example from LinuxServer.io, but modified in the style of this channel.
We start by declaring the Docker Network for our proxy server, so we can have a domain name and an encrypted connection.
Next, let’s create a volume to store the data of the home directory so it will be persisted after restarts.
If you don’t need to persist data, you won’t need to create any volume.
For the Webtop service, we are going to run the official image from LinuxServer.
There are multiple tags available which will launch different distros and desktop environments.
You can find the full list on their website.
The default is Alpine with the XFCE desktop, which is a lightweight combo.
We can choose the combo we are more comfortable with.
I personally prefer Ubuntu with KDE.
There is a security options setting which we haven’t used before.
The value seccomp:unconfined will allow the Webtop container to use more Linux sys-calls, but this setting is not required.
For the environment variables, the first two are for configuring the Linux user and group for running the container processes.
The containers from LinuxServer.io let us do this, so the container won’t have root privilege and have a lower risk of accessing our host OS.
1000 is typically the default non-root user and group ID for Linux.
If you want to use other users, you can use the id $username command to find the user and group ID.
The TZ environment is for setting the timezone.
The TITLE is the website name that shows up in our browser tab.
We can optionally set up a PASSWORD environment for the Webtop, and it will do basic HTTP auth with this password.
If you want stronger authentication, you can check my video on Authelia and set up a proxy-based single sign-on system.
For networks, we are connecting the proxy network to the Webtop so we can access it through our proxy server.
Webtop has two ports available: 3000 and 3001.
The 3000 is a port for HTTP and 3001 is for HTTPS.
We are going to rely on our proxy server for HTTPS, so let’s just use the port 3000.
We can use the expose section to remind ourselves which port to use.
For volumes, we are going to mount the home volume to the /config path, which is the home path for Webtop containers.
With this the data under /config will be persisted after container restarts.
You can mount other paths or volumes to the container so you will be able to access them in your Webtop.
For example, you can map the docker socket in your host to the Webtop container, so you can manage your docker there.
The shm_size is for setting the shared memory size for the container.
Shared memory is for inter-process communication, and a larger size will benefit applications like browsers.
We are also going to update our proxy server configuration to add a sub-domain for Webtop.
I’m using Caddy so I add a Caddy rule to proxy the domain webtop.home.easyselfhost.com to the webtop service with port 3000.
To start running Webtop, let’s go to the server command line and navigate to the directory that has the Docker compose file.
And from here let’s run docker compose up -d to start the Webtop.
We also need to refresh our proxy configuration.
For me, I’ll restart the Docker Compose for my Caddy server.
Now we can go to the browser and type in the domain name for our Webtop.
For me, it’s webtop.home.easyselfhost.com.
Then we can see the Linux desktop inside our browser tab.
Let’s try to do some desktop stuff here.
For example, let’s open the pre-installed FireFox browser and open a website.
Browsers in the Webtop is really useful because it’s completely isolated from our personal computers.
And at the same time it’s on our server with our other self-hosted applications.
A good use case for me is to download videos to my Jellyfin server that are very hard without a browser.
To do that, I add the Jellyfin media volume to the Webtop Docker Compose, and mount it to the container.
Then in the Webtop browser, I’ll download the video directly to the directory that is my media volume.
And I can also use the file manager in the Webtop to manage my video files like naming it.
We can also install desktop applications like VS Code to our Webtop.
But there is a catch on installing applications to the Webtop.
Normally when you install apps on Linux, the package manager will install them to the system directory.
And because we are not persisting any directories other than our user directory, the application will be lost after we completely restart the container.
You may still find the app in your desktop but the actual files are gone and you cannot open it.
The LinuxServer team provides another package manager that can install apps to our user directory.
It’s called proot-apps , and we can use it to install apps like VS Code with the command proot-apps install vscode.
Now even if you restart your container, the app will still exists.
You can view the full list of applications supported by proot-apps on the GitHub page.
Webtop is also usable on mobile devices, and I often use it to do some simple desktop stuff.
Webtop will change the resolution to match your browser window, so you wouldn’t need to scroll very often on your mobile browser.
One thing that is not very intuitive on mobile is the keyboard.
Webtop itself is not able to activate your mobile keyboard, and you need to go to the setting and open the ‘show virtual keyboard control’ option.
And then when you need the keyboard, just press the keyboard button on the bottom right corner.
Finally, I know you are going to try anyway, but if you open your Webtop inside your Webtop, it will crash the whole thing.
That’s all I want to show you today.
Please consider subscribing for content like this.
You can find the configuration files in this video on GitHub and the link is in description below.
Thank you for watching.