{"title":"Using X11Docker for secure GUI applications","url":"https://seanbehan.ca/posts/x11docker","description":"Running GUI applications like telegram-desktop inside a container with x11docker, xpra and Wayland.","author":"Sean Behan","published":"2021-10-07T20:51:51.000Z","updated":"2026-09-13T02:49:04.774Z","draft":false,"tags":["Docker","graphics","Podman"],"readingMinutes":1,"image":null,"sections":[{"id":"introduction","text":"Introduction","level":2},{"id":"building-a-container-image","text":"Building a Container Image","level":2},{"id":"running-the-application-with-x11docker","text":"Running the Application with X11Docker","level":2},{"id":"running-with-wayland","text":"Running with Wayland","level":2}],"content_format":"text/markdown","content_url":"https://seanbehan.ca/posts/x11docker.md","content":"## Introduction\n\nX11Docker is a nice command line tool that allows you to run graphical applications inside podman or docker by passing them to xpra or your wayland socket. To do this you first need a `Containerfile` or `Dockerfile` to build an image with the application you want to run. In this example I'm going to run `telegram-desktop`.\n\n## Building a Container Image\n\n```\nFROM ubuntu:latest\n\nRUN apt-get update\nRUN apt-get install -y telegram-desktop\n\nCMD [\"telegram-desktop\"]\n```\n\n## Running the Application with X11Docker\n\nWe build this image with `podman build . -t telegram` and wait for it to install our packages. When it's done we can simply run it with `x11docker localhost/telegram` and it starts Telegram in Xpra.\n\n## Running with Wayland\n\nIf we wanted to start it under Wayland instead, we could run `x11docker --wayland localhost/telegram` however the package for Telegram on Ubuntu doesn't seem to have support for Wayland when I tried it.\n\nThis should work for any graphical software, even that which isn't in the repositories. You can even install more than one piece of software in a single image. Then you pass the CMD as an argument to x11docker like so `x11docker localhost/telegram telegram-desktop`.\n"}