{"version":"https://jsonfeed.org/version/1.1","title":"Vic Demuzere - Docker","home_page_url":"https://vic.demuzere.be/articles/tags/docker/","feed_url":"https://vic.demuzere.be/articles/tags/docker/feed.json","description":"Blog posts tagged Docker by Vic Demuzere","language":"en","items":[{"id":"https://vic.demuzere.be/articles/static-gallery-with-thumbsup/","content_html":"<p>I've been looking for a way to host online photo galleries for a while.\nSince the rise of social media a lot of &quot;do it yourself&quot; projects have been abandoned.\nFor galleries this means that they're stuck in the age of HTML tables and ugly designs.\nThe social media generation <strong>expects easy to use and well designed user interfaces</strong>.\nI don't want to give them a chance to say &quot;it would have been better on social media.&quot;</p>\n<p>As my own website is statically generated my web server does not provide any scripting capabilities.\nThis makes it secure, low maintenance and fast.\nIn order to be hosted on the same server, the gallery <strong>should be generated upfront and require no server-side code</strong>.\nPicture galleries are something I tend to forget, I don't want to be doing security updates for a grid of images.</p>\n<p>After trying a few tools, I ended up using <a href=\"https://thumbsup.github.io/\" title=\"thumbsup\">thumbsup</a>.\nIt's very easy to use and creates great albums <strong>mostly with default settings</strong>.\nNo configuration files, no special projects: just give it a folder with images and it'll create something nice.</p>\n<p><img src=\"https://vic.demuzere.be/assets/articles/images/FNb7V7tLnMZ0WeLcNBuTw6rek7IgSd4j.jpg\" alt=\"Gallery created by thumbsup\" /></p>\n<p>The command below creates a basic gallery with the great <a href=\"https://thumbsup.github.io/docs/4-themes/built-in/#flow\" title=\"Thumbsup flow theme\">built-in flow theme</a>.\nRunning it in docker makes it even easier as you don't have to mind the python and image resizing dependencies.</p>\n<pre><code>docker run -t \\\n\t-v /path/to/source:/input:ro \\\n\t-v /path/to/gallery:/output \\\n\t-u $(id -u):$(id -g) \\\n\tghcr.io/thumbsup/thumbsup:2.16.0 \\\n\tthumbsup \\\n\t--input /input \\\n\t--output /output \\\n\t--title &quot;Gallery title&quot; \\\n\t--cleanup \\\n\t--theme flow\n</code></pre>\n<p>The resulting gallery in the output directory is self-containing: it doesn't need the source folder to function.\nOther than that, the website it creates works as you'd expect when opening a folder of images.\nSubfolders are represented as galleries named after the folder, images in the root folder are shown below the galleries.</p>\n<p>More configuration options can be found in the <a href=\"https://thumbsup.github.io/docs/3-configuration/usage/\" title=\"Thumbsup basic usage documentation\">thumbsup documentation</a>.</p>\n<div class=\"footer\"><hr><p>Thanks for subscribing to my feed!</p><p>Feel free to e-mail comments or corrections to <a href=\"mailto:vic@demuzere.be?subject=RE%3A%20Static%20photo%20gallery%20with%20thumbsup\">vic@demuzere.be</a>.</p></div>","url":"https://vic.demuzere.be/articles/static-gallery-with-thumbsup/","date_published":"2019-12-23T16:13:30Z","date_modified":"2026-05-13T17:29:47Z","language":"en"},{"id":"https://vic.demuzere.be/articles/combining-traditional-configuration-management-with-docker/","content_html":"<p>Configuration management systems like Ansible, Chef, Salt and Puppet are the <em>traditional</em> and proven way to automate server management.\nUsing a tool like one of these has a lot of benefits over manual configuration: Setting up a new server (for new projects or to replace a broken server) can be performed faster and more accurately than we could do manually.\nIt also makes sure that servers and individual services are configured exactly the same when you're doing it multiple times.\nNo doubt about the benefits of configuration management systems.</p>\n<h2 id=\"hello-docker\">Hello Docker!<a href=\"#hello-docker\" aria-label=\"Link to heading 'Hello Docker!'\" data-heading-content=\"Hello Docker!\" class=\"anchor\"></a></h2>\n<p>Then Docker came and brought a new way to manage services.\nWith the <strong>Dockerfile</strong> it introduced a standardized way to describe exactly what should be running inside a container.\nWhile containers were nothing new, the easy to use of the Docker toolchain changed everything.</p>\n<p>If you're just managing a few servers and are not planning to scale using Kubernetes or similar orchestration tools, <strong>using docker can make managing your services harder</strong>.\nKeeping containers up to date means you have to manage another package manager and configuration depends on whatever the image maintainer decided to add to the image.\nHaving a bit more flexibility in the software you're running is awesome, though!\nThat's why I decided to <strong>combine services running inside Docker containers with traditional configuration management</strong>.</p>\n<h2 id=\"hybrid-configuration\">Hybrid configuration<a href=\"#hybrid-configuration\" aria-label=\"Link to heading 'Hybrid configuration'\" data-heading-content=\"Hybrid configuration\" class=\"anchor\"></a></h2>\n<p>Since I want to use my existing Ansible code to manage nginx and its configuration, I need to be able to:</p>\n<ul>\n<li>Start, stop and reload my nginx service using systemd</li>\n<li>Configure nginx in <code>/etc/nginx</code></li>\n<li>View and cycle logs in <code>/var/log/nginx</code></li>\n<li>Connect to local services outside the container (<code>php-fpm</code>, Go webservices, ..)</li>\n<li>Publish websites with document roots in <code>/var/www</code></li>\n</ul>\n<p>But I also want features that I can't get on my standard debian system like TLS 1.3 and brotli compression.</p>\n<h2 id=\"managing-a-containerized-nginx-service-with-systemd\">Managing a containerized nginx service with systemd<a href=\"#managing-a-containerized-nginx-service-with-systemd\" aria-label=\"Link to heading 'Managing a containerized nginx service with systemd'\" data-heading-content=\"Managing a containerized nginx service with systemd\" class=\"anchor\"></a></h2>\n<p>First step was to create an <a href=\"https://hub.docker.com/r/sorcix/nginx/\">nginx docker image</a> with support for everything I want.\nThe systemd unit below takes care of downloading and starting the container on my server.\nVolumes are mounted on every important path listed above to make sure I can configure everything as if the nginx service was installed using the default Debian package.</p>\n<pre><code>[Unit]\nDescription=Nginx\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nTimeoutStartSec=0\nRestart=always\nExecStartPre=/usr/bin/docker pull sorcix/nginx:latest\nExecStart=/usr/bin/docker run --net=host --name nginx --rm -v /etc/nginx:/etc/nginx:ro -v /var/log/nginx:/var/log/nginx:rw -v /etc/ssl:/etc/ssl:ro -v /var/www:/var/www sorcix/nginx:latest\nExecReload=/usr/bin/docker exec nginx nginx -s reload\nExecStop=/usr/bin/docker exec nginx nginx -s quit\n\n[Install]\nWantedBy=multi-user.target\n</code></pre>\n<h3 id=\"networking--security\">Networking &amp; security<a href=\"#networking--security\" aria-label=\"Link to heading 'Networking &amp; security'\" data-heading-content=\"Networking &amp; security\" class=\"anchor\"></a></h3>\n<p>The <code>--net=host</code> part makes the container use host networking instead of the separate docker network that is usually created for containers.\nForwarding ports 80 and 443 is not required (which actually makes traffic handling a little faster) and we can connect to services running on the host.\nNote that this also means that the additional security that containers usually provide is now missing.\nThat's fine with me as I'm using this as a drop in replacement for the default Debian nginx package which does not provide containerization at all.</p>\n<h3 id=\"updates\">Updates<a href=\"#updates\" aria-label=\"Link to heading 'Updates'\" data-heading-content=\"Updates\" class=\"anchor\"></a></h3>\n<p>The <code>ExecStartPre</code> command downloads new versions of the <code>sorcix/nginx</code> container every time I restart nginx.\nAs I manage the container image myself this isn't really an issue, but you should disable this when using images created by others.</p>\n<div class=\"footer\"><hr><p>Thanks for subscribing to my feed!</p><p>Feel free to e-mail comments or corrections to <a href=\"mailto:vic@demuzere.be?subject=RE%3A%20Combining%20traditional%20configuration%20management%20with%20Docker\">vic@demuzere.be</a>.</p></div>","url":"https://vic.demuzere.be/articles/combining-traditional-configuration-management-with-docker/","date_published":"2018-10-15T18:23:00Z","date_modified":"2023-11-28T19:55:32Z","language":"en"}]}