Webtops - Linux Desktops in Docker
Many times I've wished I had better access to a desktop machine when in various odd places... Maybe I had an iPad, or my phone, but really needed a desktop machine in order to do some specific work that is, simply put, just easier with a regular Linux machine.
If only I'd had Webtops! Webtops is a project where you can setup a variety of Linux desktops, with a variety of Desktop Environments in Docker, and access them through a web browser! it's truly fantastic!
Today, I'm showing you how to install them, and get them up and running. The best part is, they run, just like a desktop on your native hardware. You can update them, install software on them, and in my testing on my Digital Ocean setup, they are fast!
What You'll Need
- A machine or VPS to run the Webtop(s) on.
- Docker-CE and Docker Compose installed
- (Optionally) Portainer-CE Installed
- About 20 Minutes of time.
Installing Docker and Docker-CE
If you don't already have Docker and Docker-Compose setup, you'll want to get those installed. I have a script out on GitHub that will help you do that with ease.
You can just get the script with the command:
wget https://gitlab.com/bmcgonag/docker_installs/-/raw/main/install_docker_nproxyman.sh
This will pull down the script to your machine. NOTE: this is a bash script, so you'll need a bash shell to run it (most Linux systems have bash by default).
Make the script executable with the command:
chmod +x install_docker_nproxyman.sh
Next, execute the script with the command
./install_docker_nproxyman.sh
You'll be prompted to select your OS, then asked what you want to install. Simply answer "y" to any of the items you want installed.
I recommend, Docker-CE, Docker-Compose, and Portainer-CE.
Installing Webtops on Docker
Now that you have Docker-CE, Docker-Compose, and potentially Portainer-CE installed, we'll move on to installing Webtops.
Normally, I don't tlak much about the tags of Docker images, but in this case, the tags are very important. The tags for the images, are how you select which Distro and Desktop Environment you'll get setup.
So check out that tags on the LinuxServer.io page for Webtops.
The first install we'll do is based on the "latest" tag, which at the time of writing is an Alpine distro with the very clean and light-weight XFCE desktop environment.
If you are using portainer, navigate to your install, and start a new Stack. Name it "webtop-latest", and then paste the following code into the block editor space.
If you are using docker-compose, then make a folder called "webtop-latest", and cd into it.
mkdir webtop-latest
- Makes the folder
cd webtop-latest
- moves you into that folder.
Now, create a docker-compose.yml file with:
nano docker-compose.yml
and paste the following code block into it:
version: "2.1"
services:
webtop:
image: lscr.io/linuxserver/webtop
container_name: webtop-latest
privileged: true #optional
security_opt:
- seccomp:unconfined #optional
environment:
- PUID=1000
- PGID=1000
- TZ=<your/timezone>
- SUBFOLDER=/ #optional
volumes:
- </path/to/data>:/config
- /var/run/docker.sock:/var/run/docker.sock #optional
ports:
- 3000:3000 # change the left side port if you can't use 3000
shm_size: "1gb" # optional
restart: unless-stopped
Regardless of whether you're doing this in Portainer-CE, or Docker-Compose, you'll need to update some of the values in the code-block above.
I have surrounded values with "<" and ">" symbols where you must make a change.
There are comments (signified by the "#" symbol) where you have optional changes you can make if you want / need to.
First, set the timezone for your location. I live in Central Time US, which is generally signified as "America/Chicago" so my timezone line would look like
- TZ=America/Chicago
Next, update the path for your data storage on your webtop. I added my webtop-latest folder under the path /home/brian/docker/webtop-latest
, and my docker-compose.yml file is in that folder, so I could just use ./
as my path, but I prefer absolute paths vs. relative paths. So my path entry looks like:
- /home/brian/docker/webtop-latest:/config
Next, you can update the left side of the port mapping. The left side is the port on your host machine, and the right side is the port in the container. The container expects the application to use port 3000, so don't change the right side. You can change the left side, however, to point your host machine port 3020, for instance, to forward to the container port 3000. If you made this change, you'd then access your webtop via the host IP address or domain name, on port 3020.
Finally, you can change the memory limit "shm" from 1gb to anything you want, or you can omit the entry altogether.
Once you've made these changes, make sure to save your docker-compose.yml file by pressing CTRL + O, then Enter to confirm, and then CTRL + X to exit the nano editor.
In Portainer, simply click the "Deploy Stack" button to begin pulling down the image an start the container.
For docker-compose, type:
docker-compose up -d
in the command line, and you'll be up and running in no time.
Now you can access your new Linux Desktop (WebTop) from the web browser at the IP or Hostname of your host machine, on the port you put in the left side of the port mapping.
I accessed my local host on http://192.168.10.26:3020
Install another Webtop with a Different Distro and Desktop Environment
Let's repeat what we did above, but pick a different Distro and DE. First, if you're working in the CLI (Commandn Line Interface) go back a level with
cd ..
If you're in Portainer, just click the Stacks menu option, and add a new stack.
In the CLI, create a new folder called "Webtop-Ubuntu-KDE"
mkdir Webtop-Ubuntu-KDE
and move into that folder
cd Webtop-Ubuntu-KDE
Now create a new docker-compose file with
nano docker-compose.yml
In Portainer-CE name your new stack "webtop-ubuntu-kde", and then paste the following code block into the code block area:
for the CLI, paste it into your docker-compose.yml file.
version: "2.1"
services:
webtop:
image: lscr.io/linuxserver/webtop:ubuntu-kde
container_name: webtop-ub-kde
privileged: true #optional
security_opt:
- seccomp:unconfined #optional
environment:
- PUID=1000
- PGID=1000
- TZ=<your/timezone>
- SUBFOLDER=/ #optional
volumes:
- </path/to/data>:/config
- /var/run/docker.sock:/var/run/docker.sock #optional
ports:
- 3021:3000
shm_size: "1gb" #optional
restart: unless-stopped
Once you've pasted this in, make sure to update the appropriate areas (TZ, Path, etc), then save it in the CLI with CTRL + O, then enter to confirm, and CTRL + X to exit nano.
If you're in Portainer, click the deploy stack button, and if you're in the CLI enter
docker-compose up -d
Soon, you'll be able to reach your ubuntu kde system in the browser at the IP or hostname of the machine, on port 3021 (unless you changed it).
That's it, now you know how to get an Linux Distro and Desktop up and running in no time in the browser!
Support my Channel and Content
Support my Channel and ongoing efforts through Patreon:
https://patreon.com/AwesomeOpenSource