<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<atom:link href="https://seanbehan.ca/posts/tag/docker/rss.xml" rel="self" type="application/rss+xml" />
		<title>Sean Behan — Docker</title>
		<link>https://seanbehan.ca/posts/tag/docker</link>
		<description>Posts tagged “Docker”.</description>
		<language>en-CA</language>
		<!-- RSS wants an address here and readers show the name beside it. -->
		<managingEditor>sean@seanbehan.ca (Sean Behan)</managingEditor>
		<webMaster>sean@seanbehan.ca (Sean Behan)</webMaster>
		<lastBuildDate>Sun, 30 Aug 2026 05:19:09 GMT</lastBuildDate>
		<item>
		<guid isPermaLink="true">https://seanbehan.ca/posts/x11docker</guid>
		<title><![CDATA[Using X11Docker for secure GUI applications]]></title>
		<description><![CDATA[Running GUI applications like telegram-desktop inside a container with x11docker, xpra and Wayland.]]></description>
		<link>https://seanbehan.ca/posts/x11docker</link>
		<pubDate>Thu, 07 Oct 2021 20:51:51 GMT</pubDate>
		<category>docker</category><category>graphics</category><category>podman</category>
		<content:encoded><![CDATA[<h3>Introduction</h3><p>X11Docker is a nice command line tool that allows you to run graphical</p><p>applications inside podman or docker by passing them to xpra or your wayland</p><p>socket. To do this you first need a <code>Containerfile</code> or <code>Dockerfile</code> to build an</p><p>image with the application you want to run. In this example I&#x27;m going to run</p><p><code>telegram-desktop</code>.</p><h3>Building a Container Image</h3><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span>FROM ubuntu:latest</span></span>
<span class="line"><span></span></span>
<span class="line"><span>RUN apt-get update</span></span>
<span class="line"><span>RUN apt-get install -y telegram-desktop</span></span>
<span class="line"><span></span></span>
<span class="line"><span>CMD ["telegram-desktop"]</span></span></code></pre><h3>Running the Application with X11Docker</h3><p>We build this image with <code>podman build . -t telegram</code> and wait for it to</p><p>install our packages. When it&#x27;s done we can simply run it with `x11docker</p><p>localhost/telegram` and it starts Telegram in Xpra.</p><h3>Running with Wayland</h3><p>If we wanted to start it under Wayland instead, we could run `x11docker</p><p>--wayland localhost/telegram` however the package for Telegram on Ubuntu</p><p>doesn&#x27;t seem to have support for Wayland when I tried it.</p><p>This should work for any graphical software, even that which isn&#x27;t in the</p><p>repositories. You can even install more than one piece of software in a single</p><p>image. Then you pass the CMD as an argument to x11docker like so `x11docker</p><p>localhost/telegram telegram-desktop`.</p>]]></content:encoded>
	</item>
<item>
		<guid isPermaLink="true">https://seanbehan.ca/posts/podman-systemd</guid>
		<title><![CDATA[Podman Auto Updating Systemd Services]]></title>
		<description><![CDATA[podman generate systemd plus an autoupdate label: containers that start on boot and update themselves.]]></description>
		<link>https://seanbehan.ca/posts/podman-systemd</link>
		<pubDate>Thu, 23 Sep 2021 14:34:43 GMT</pubDate>
		<category>docker</category><category>linux</category><category>podman</category>
		<content:encoded><![CDATA[<h3>Introduction</h3><p>Podman[^1] has a nice feature called <code>generate</code> that lets you generate</p><p>different kinds of configuration files for starting pods. One that I use often</p><p>is <code>podman generate systemd</code> which generates a new user service that can be</p><p>started with <code>systemctl --user start container-yourcontainer.service</code> or</p><p>enabled.</p><h3>Auto-Updating Containers</h3><p>If you want your container to auto update you can simply pass it the flag</p><p><code>--label &quot;io.containers.autoupdate=registry&quot;</code> when you&#x27;re creating it. The</p><p>systemd service will automatically pull the latest versions of containers</p><p>before starting them. You can manually update your container images now using</p><p><code>podman auto-update</code>.</p><p>If you want to update your images on a schedule you can enable the</p><p><code>podman-auto-update.timer</code> using `systemctl --user enable --now</p><p>podman-auto-update.timer` which will auto update your containers every Monday</p><p>morning.[^2]</p><h3>Kubernetes YAML Generation</h3><p>You can also generate a Kubernetes YAML configurations using `podman generate</p><p>kube`. This can then be loaded in Kubernetes to run your containers.</p><p>[^1]: https://podman.io</p><p>[^2]: https://fedoramagazine.org/auto-updating-podman-containers-with-systemd/</p>]]></content:encoded>
	</item>
<item>
		<guid isPermaLink="true">https://seanbehan.ca/posts/podman-crun</guid>
		<title><![CDATA[Podman crun and cgroups v2]]></title>
		<description><![CDATA[Getting Podman onto cgroups v2 and crun on distributions that still default to cgroups v1 and runc.]]></description>
		<link>https://seanbehan.ca/posts/podman-crun</link>
		<pubDate>Sun, 19 Sep 2021 03:09:02 GMT</pubDate>
		<category>docker</category><category>linux</category><category>podman</category>
		<content:encoded><![CDATA[<h3>Introduction</h3><p>Podman[^1] is a container management software similar to Docker that can run</p><p>OCI containers as regular users (not root) by using container management</p><p>libraries such as crun or runc, and cgroups v1 or v2. It can be used as a</p><p>drop-in replacement for Docker and supports docker-compose using</p><p>podman-compose.</p><p>Unfortunately for some distributions after installing podman the operating</p><p>system defaults to cgroups v1 and runc, not cgroups v2 and crun. As was the</p><p>case on Rocky Linux for me.</p><h3>Switching to crun</h3><p>First we can switch to crun instead of runc by installing crun with our package</p><p>manager. It was already installed for me, but on Fedora you would use `sudo dnf</p><p>install crun`</p><p>Then you can edit the file <code>/usr/share/containers/containers.conf</code> and change</p><p>the line <code>runtime = &quot;runc&quot;</code> to <code>runtime = &quot;crun&quot;</code>. Now you can verify that</p><p>you&#x27;re using crun with <code>podman info | grep crun</code>.</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span>name: crun</span></span>
<span class="line"><span>package: crun-0.20.1-1.module+el8.4.0+643+525e162a.x86_64</span></span>
<span class="line"><span>path: /usr/bin/crun</span></span>
<span class="line"><span>  crun version 0.20.1</span></span></code></pre><h3>Enabling cgroups v2</h3><p>Now the harder part was enabling cgroups v2. Luckily I found a</p><p><a href="https://github.com/containers/podman/issues/9410#issuecomment-785840320">comment</a></p><p>on a GitHub issue outlining the steps you need to complete to get cgroups v2 to</p><p>work.</p><p>First we can enable it in the kernel with</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span>sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=1"</span></span></code></pre><p>Then we can enable linger. This will also allow our containers to remain</p><p>running after logging out.</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span>sudo loginctl enable-linger codebam</span></span></code></pre><p>Then the last step which made everything work for me is to set the</p><p><code>pid_limit=0</code>. For me it was in <code>/usr/share/containers/containers.conf</code> instead</p><p>of <code>/etc/containers/</code>.</p><h3>Verification</h3><p>Now you can reboot. <code>podman info | grep cgroup</code> should say</p><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span>cgroupControllers: []</span></span>
<span class="line"><span>cgroupManager: systemd</span></span>
<span class="line"><span>cgroupVersion: v2</span></span></code></pre><p>Now we&#x27;re using cgroups v2 and crun.</p><p>[^1]: https://podman.io</p>]]></content:encoded>
	</item>
	</channel>
</rss>