{"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":null,"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\n\napplications inside podman or docker by passing them to xpra or your wayland\n\nsocket. To do this you first need a `Containerfile` or `Dockerfile` to build an\n\nimage with the application you want to run. In this example I'm going to run\n\n`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\n\ninstall our packages. When it's done we can simply run it with `x11docker\n\nlocalhost/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\n\n--wayland localhost/telegram` however the package for Telegram on Ubuntu\n\ndoesn'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\n\nrepositories. You can even install more than one piece of software in a single\n\nimage. Then you pass the CMD as an argument to x11docker like so `x11docker\n\nlocalhost/telegram telegram-desktop`.\n"}