HomeDockerWebtops a Linux Desktop in Your Web Browser

Webtops a Linux Desktop in Your Web Browser

Before I joined the LinuxServer organization I had been working on a Docker management resolution called Taisun. Over the years it became apparent everybody downloading this application was only really using the subfeature to be able to run a Linux desktop in their web browser. From parts of this project we as a team initiated deploying containers for wellliked GUI applications in docker containers and have now launched:
https://hub.docker.com/r/linuxserver/webtop

This technology stack goes a bit against the Docker grain as we are operating many services in a single container to facilitate spinning up a usable web based desktop experience with a single command consisting of:

A lot of different Docker GUI solutions exist today, but what we always found is they were just missing some common sense stuff like:

  • Pixel excellent resolution for rendering
  • A basic window supervisor
  • Audio support
  • Using the RDP protocol
  • Clipboard support
  • On screen keyboard support
  • Remote file management for uploads/downloads

Because we control the whole stack and went into this with the design philosophy of building a baseimage any Linux GUI app could be easily embedded in, doing a desktop environment where users could customise it to their needs by installing the packages they want, seemed like the logical next step.

For Users

Basic Usage:

Spinning up is relatively straightforward:

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 until-stopped 
  ghcr.io/linuxserver/webtop

Hop into http://localhost:3000 and you should be greeted with an Alpine XFCE desktop environment:

Webtops a Linux Desktop in Your Web Browser

On the left hand side of the screen is an arrow that will expand a menu with some baked in features, this menu can also be opened and closed using the keyboard combination of ctrl+alt+shift:

1622566553 290 Webtops a Linux Desktop in Your Web Browser

From this menu you can launch a file browser, a keyboard overlay, or pull clipboard contents in and out of the desktop. The current webtop’s clipboard contents will be in the text area in the menu and any text you enter in there will be available on the webtop’s native clipboard. If you are a heavy user pressing ctrl+alt+shift to move clipboard contents in and out becomes second nature.

Flavors:

The image is also available in Ubuntu outdoors of just Alpine in the following Desktop environments installed and pre-configured:

  • XFCE
  • KDE
  • MATE
  • i3
  • Openbox
  • IceWM

Please take a gaze at the Github Repo for updated lists of supported tags:

https://github.com/linuxserver/docker-webtop

Authentication:

By default the image is based around the abc user and we recommend using this user as all of the init/config is based around it. The default password is also abc . If you want to change this password and require authentication when accessing the interface simply issue passwd inside a gui terminal in the webtop. Then when accessing the web interface use the path:

http://localhost:3000/?login=true

1622566553 521 Webtops a Linux Desktop in Your Web Browser

This will bring up xrdp’s default login supervisor where you can enter the credentials you set inside of the container.

If you are planning to publish this port to the internet to hop into your remote server first off never do it over plain http you will expose your credentials, also we highly recommend doing 2 layers of security and operating something like SWAG with password authentication at the reverse proxy level:

https://github.com/linuxserver/docker-swag

Keeping Up to Date:

As stated previously baking a whole Linux desktop env is not really suitable with the classic Docker model, and because these are designed to be customized by the user inside the operating container we highly recommend not using Docker to handle image updates. Your user’s home folder will stay in tact with it’s files and settings but you would lose any software you installed inside of the container. Instead just use Alpine and Ubuntu’s package managers to hold software up to date inside the container.

Alpine:

sudo apk upgrade

Ubuntu:

sudo apt-get update && sudo apt-get dist-upgrade -y

Building an image:

We tried to make using our desktop base image for embedding a desktop application as easy as possible. Let’s take a gaze at an example Dockerfile for a Firefox container:

FROM lsiobase/rdesktop-web:alpine

RUN 
 echo "**** install packages ****" && 
 apk add --no-cache 
	firefox-esr && 
 echo "**** cleanup ****" && 
 rm -rf 
	/tmp/*

# add native files
COPY /root /

# ports and volumes
EXPOSE 3000
VOLUME /config

On top of installing the app in the Dockerfile you need to create the file /root/defaults/autostart with the contents firefox.

And that’s it, when the container spins up and the user accesses the web interface on port 3000 Firefox will be launched in a basic Openbox gui:

1622566553 597 Webtops a Linux Desktop in Your Web Browser

For a slightly more advanced example check out the LibreOffice image:

https://github.com/linuxserver/docker-libreoffice

Autostart applications:

By default the desktop applications will only be launched when the user logs into the web interface, if you need your application to run on container spinup you will need to set the environment variable:

-e GUIAUTOSTART=true

If the user changes the in container password from the default abc, they will also need to pass a password option to ensure the application autostarts:

-e PASSWORD=yourpassword

Branding:

If you do not want the Linuxserver splash on container spinup make sure to include a modified 1 in your repo’s path /root/etc/cont-init.d/10-adduser, the only required logic is:

#!/usr/bin/with-contenv bash

PUID=${PUID:-911}
PGID=${PGID:-911}

groupmod -o -g "$PGID" abc
usermod -o -u "$PUID" abc

chown abc:abc /app
chown abc:abc /config
chown abc:abc /defaults

If you have any questions about using these Webtop images or developing new containers based on our rdesktop-web baseimage just hop on Discord and ask:

https://discord.gg/YWrKVTn

Go to the source

Most Popular