<?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>Mon, 24 Aug 2026 08:56:20 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>podman</category><category>graphics</category>
		<content:encoded><![CDATA[<!--[--><h3>Introduction</h3> <p>X11Docker 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 <code>Containerfile</code> or <code>Dockerfile</code> to build an
image with the application you want to run. In this example I’m going to run <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
install our packages. When it’s done we can simply run it with <code>x11docker localhost/telegram</code> 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 <code>x11docker --wayland localhost/telegram</code> however the package for Telegram on Ubuntu
doesn’t seem to have support for Wayland when I tried it.</p> <p>This 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 <code>x11docker localhost/telegram telegram-desktop</code>.</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>linux</category><category>docker</category><category>podman</category>
		<content:encoded><![CDATA[<!--[--><h3>Introduction</h3> <p>Podman<a href="https://podman.io" rel="nofollow noopener noreferrer" target="_blank">^1</a> has a nice feature called <code>generate</code> that lets you generate
different kinds of configuration files for starting pods. One that I use often
is <code>podman generate systemd</code> which generates a new user service that can be
started with <code>systemctl --user start container-yourcontainer.service</code> or
enabled.</p> <h3>Auto-Updating Containers</h3> <p>If you want your container to auto update you can simply pass it the flag <code>--label "io.containers.autoupdate=registry"</code> when you’re creating it. The
systemd service will automatically pull the latest versions of containers
before starting them. You can manually update your container images now using <code>podman auto-update</code>.</p> <p>If you want to update your images on a schedule you can enable the <code>podman-auto-update.timer</code> using <code>systemctl --user enable --now podman-auto-update.timer</code> which will auto update your containers every Monday
morning.<a href="https://fedoramagazine.org/auto-updating-podman-containers-with-systemd/" rel="nofollow noopener noreferrer" target="_blank">^2</a></p> <h3>Kubernetes YAML Generation</h3> <p>You can also generate a Kubernetes YAML configurations using <code>podman generate kube</code>. This can then be loaded in Kubernetes to run your containers.</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>linux</category><category>docker</category><category>podman</category>
		<content:encoded><![CDATA[<!--[--><h3>Introduction</h3> <p>Podman<a href="https://podman.io" rel="nofollow noopener noreferrer" target="_blank">^1</a> is a container management software similar to Docker that can run
OCI containers as regular users (not root) by using container management
libraries such as crun or runc, and cgroups v1 or v2. It can be used as a
drop-in replacement for Docker and supports docker-compose using
podman-compose.</p> <p>Unfortunately for some distributions after installing podman the operating
system defaults to cgroups v1 and runc, not cgroups v2 and crun. As was the
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
manager. It was already installed for me, but on Fedora you would use <code>sudo dnf install crun</code></p> <p>Then you can edit the file <code>/usr/share/containers/containers.conf</code> and change
the line <code>runtime = "runc"</code> to <code>runtime = "crun"</code>. Now you can verify that
you’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 <a href="https://github.com/containers/podman/issues/9410#issuecomment-785840320" rel="nofollow noopener noreferrer" target="_blank">comment</a> on a GitHub issue outlining the steps you need to complete to get cgroups v2 to
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
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 <code>pid_limit=0</code>. For me it was in <code>/usr/share/containers/containers.conf</code> instead
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’re using cgroups v2 and crun.</p><!--]-->]]></content:encoded>
	</item>
	</channel>
</rss>