<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Peek Read Info (Posts about selfhost)</title><link>https://peekread.info/</link><description></description><atom:link href="https://peekread.info/tags/selfhost.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2024 &lt;a href="mailto:dugite-code@peekread.info"&gt;Dugite-Code&lt;/a&gt; 
&lt;a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"&gt;
&lt;img alt="Creative Commons License BY-SA"
width="88px" height="31px" style="border-width:0; margin-bottom:12px;"
src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png"&gt;&lt;/a&gt;</copyright><lastBuildDate>Wed, 14 Feb 2024 06:33:10 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>I am a Docker Convert</title><link>https://peekread.info/tech/20200121-i-am-a-docker-convert/</link><dc:creator>Dugite-Code</dc:creator><description>&lt;p&gt;&lt;/p&gt;&lt;div class="d-flex position-relative pt-3 pb-3"&gt;
    &lt;div class="flex-shrink-0 me-3"&gt;
        &lt;img data-pagefind-meta="image[src], image_alt[alt]" style="height:89px;" src="https://peekread.info/images/services/docker.png" alt=""&gt;
    &lt;/div&gt;
    &lt;div&gt;
        &lt;p class="mt-3"&gt;&lt;/p&gt;&lt;p&gt;I've changed my mind quite a bit when it comes to docker. I used to be a big believer in virtual machines, I still am, but for individual 'applications' Docker makes a fair bit of sense.&lt;/p&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;Reasons to I use Docker&lt;/h2&gt;
&lt;h3&gt;Simplicity&lt;/h3&gt;
&lt;p&gt;Docker is the simplest way to replicate a developer's environment on your own computer. No more dealing with differing distro's varying update cycles and the conflicting packages causing edge case issues, because everything is in it's own little box. Nice and predictable.&lt;/p&gt;
&lt;p&gt;This saves you time setting things up because at least all the components are included. Configuration is still a pain on some projects, but at least your not missing any metaphorical screws.&lt;/p&gt;
&lt;p&gt;The biggest example for this was my mailserver. I used &lt;a href="https://github.com/modoboa/modoboa/"&gt;modoboa&lt;/a&gt; a great simple mailserver package. The issues were having things brake from system package updates and just updating the package itself was damned complicated. I learnt a lot from these breakages, so much so when I switched to docker I switched to using &lt;a href="https://github.com/tomav/docker-mailserver"&gt;docker-mailserver&lt;/a&gt; a image that has no Web GUI for configuration.&lt;/p&gt;
&lt;p&gt;Updates, while problematic to monitor in docker are now a simple painless affair.&lt;/p&gt;
&lt;h3&gt;Lightweight&lt;/h3&gt;
&lt;p&gt;Unlike a virtual machine you don't need to replicate &lt;strong&gt;everything&lt;/strong&gt; in a container. This makes it easier to have more services that conflict with each other running side by side. I used to have one &lt;a href="https://en.wikipedia.org/wiki/Next_Unit_of_Computing" title="Next Unit of Computing (NUC) is a line of small-form-factor barebone computer kits designed by Intel."&gt;dedicated NUC&lt;/a&gt; for my mailserver and another for all my other services. I've now condensed it all onto the single NUC with better overall performance thanks to docker.&lt;/p&gt;
&lt;h3&gt;Portability&lt;/h3&gt;
&lt;p&gt;One of the biggest advantages to docker is portability. If you take your raw data and docker-compose files throw them onto a completely separate machine and within a few minutes you are up and running again. For virtual machines this would take significant work and, in my experience often fails.&lt;/p&gt;
&lt;h2&gt;The Issues I have with docker&lt;/h2&gt;
&lt;h3&gt;The pre-built images&lt;/h3&gt;
&lt;p&gt;The &lt;a href="https://www.zdnet.com/article/alpine-linux-docker-images-ship-a-root-account-with-no-password/"&gt;Alpine image root issue&lt;/a&gt; last year, where the base image used to build a large number of docker images shipped with a vulnerability, made it obvious you need an actively maintained update cycle.&lt;/p&gt;
&lt;p&gt;If the project you are using doesn't provide a docker image or even a dockerfile you will often find pre-built images on docker-hub. The big question you need to ask is if you can trust these images. Check the source repository and decide if it would make more sense to build the image yourself.&lt;/p&gt;
&lt;h3&gt;Keeping pre-built images up-to date&lt;/h3&gt;
&lt;p&gt;One of the biggest issues people have with docker is the lack of update tracking. Thankfully this can be overcome using the &lt;a href="https://github.com/containrrr/watchtower"&gt;Watchtower&lt;/a&gt; image.&lt;/p&gt;
&lt;p&gt;I set watchtower to monitor only mode because automatic updates are &lt;a href="https://fedoraproject.org/wiki/AutoUpdates#Reasons_AGAINST_using_automatic_updates" title="While no one can determine for you if your machine is a bad candidate for automatic updates, there are several things which tend to make a machine a worse candidate for automatic updates."&gt;sometimes a terrible idea&lt;/a&gt;.&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="nt"&gt;watchtower&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;containrrr/watchtower&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;container_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;watchtower&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p p-Indicator"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;/var/run/docker.sock:/var/run/docker.sock&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;restart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;unless-stopped&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p p-Indicator"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;WATCHTOWER_POLL_INTERVAL=86400&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c1"&gt;#Poll every 24 hours&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p p-Indicator"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;WATCHTOWER_MONITOR_ONLY=true&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p p-Indicator"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;WATCHTOWER_NOTIFICATIONS=gotify&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p p-Indicator"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;WATCHTOWER_NOTIFICATION_GOTIFY_URL=https://example.tld/gotify/&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p p-Indicator"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;WATCHTOWER_NOTIFICATION_GOTIFY_TOKEN=###########&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Importantly for locally built images add the disable label to their docker-compose files, or you will constantly get notifications saying &lt;code&gt;(info): Unable to update container /examplecontainer. Proceeding to next.&lt;/code&gt;&lt;/p&gt;
&lt;div class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="p p-Indicator"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;com.centurylinklabs.watchtower.enable=false&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;</description><category>docker</category><category>selfhost</category><guid>https://peekread.info/tech/20200121-i-am-a-docker-convert/</guid><pubDate>Mon, 20 Jan 2020 16:00:00 GMT</pubDate></item></channel></rss>