main
1<!DOCTYPE html>
2<html lang="en">
3<head>
4<!-- Sep 03, 2024 -->
5<meta charset="utf-8" />
6<meta name="viewport" content="width=device-width, initial-scale=1" />
7<title>You may not need a =Dockerfile= 🐳</title>
8<meta name="author" content="Vincent Demeester" />
9<meta name="keywords" content="post" />
10<meta name="generator" content="Org Mode" />
11<link rel="stylesheet" type="text/css" href="/css/2022.css" />
12<link rel="stylesheet" type="text/css" href="/css/syntax.css" />
13<link rel='icon' type='image/x-icon' href='/images/favicon.ico'/>
14<meta name='viewport' content='width=device-width, initial-scale=1'>
15</head>
16<body>
17<main id="content" class="content">
18<header>
19<h1 class="title">You may not need a <code>Dockerfile</code> 🐳</h1>
20<p class="subtitle" role="doc-subtitle">Explore ways to create images without the <code>Dockerfile</code> generic approach</p>
21</header><p>
22Building a “docker image”, or more appropriately an OCI image, is usually associated with
23the <code>Dockerfile</code> format. Although it is one of the most <i>generic</i> way to build an OCI
24image, it is definitely not the only way, nor the best way, depending on your use case.
25<b>And</b> there is a decent amount of ways to create your image. Let’s try to explore some of
26them.
27</p>
28
29<p>
30<a href="https://imjasonh.com/">Jason</a> write an amazing article around this : <a href="https://github.com/imjasonh/ImJasonH/tree/main/articles/moving-and-building-images">Moving and Building Container Images, The Right Way</a>.
31</p>
32<section id="outline-container-Don%27t%20get%20me%20wrong%2C%20I%20used%20to%20love%20%3DDockerfile%3D%20%F0%9F%99%83" class="outline-2">
33<h2 id="Don%27t%20get%20me%20wrong%2C%20I%20used%20to%20love%20%3DDockerfile%3D%20%F0%9F%99%83">Don’t get me wrong, I used to love <code>Dockerfile</code> 🙃</h2>
34<div class="outline-text-2" id="text-Don%27t%20get%20me%20wrong%2C%20I%20used%20to%20love%20%3DDockerfile%3D%20%F0%9F%99%83">
35<p>
36I <b>love</b> <code>Dockerfile</code>. They have been extremely useful for the container ecosystem. The
37recent evolutions, backed by <a href="https://github.com/moby/buildkit"><code>buildkit</code></a> are also very good. But they do come with a bit of
38baggages:
39</p>
40
41<ul class="org-ul">
42<li>They do not <i>allow</i> (or <i>enable</i>) to write reproducible builds. The timestamps, the
43<code>RUN</code> with “random” commands is getting in the way.</li>
44<li>They bring a very <b>big assumption</b>, each and every <code>RUN</code> is running in a container. Of
45course there is tools (as we may, or may not see) that do build <code>Dockerfile</code> without
46containers, but they are a bit limited (because of that assumption).</li>
47</ul>
48</div>
49</section>
50<section id="outline-container-Questions%20to%20ask%20yourself" class="outline-2">
51<h2 id="Questions%20to%20ask%20yourself">Questions to ask yourself</h2>
52<div class="outline-text-2" id="text-Questions%20to%20ask%20yourself">
53<p>
54In order to decide what to use to build a container image, there is a couple of questions
55to answer. Your answers will help you choose what tool to use.
56</p>
57
58<ul class="org-ul">
59<li>Is “reproductible builds” something important to you ?</li>
60<li>Is your CI running in containers ?</li>
61<li>Is your developement environment running in containers ?</li>
62<li>Do you care about running things as root ?</li>
63<li>Do you care about running things as <b>privileged</b> (aka giving the keys to escape the
64containers to the process running in the container) ?</li>
65</ul>
66</div>
67</section>
68</main>
69<footer id="postamble" class="status">
70<footer>
71 <small><a href="/" rel="history">Index</a> • <a href="/sitemap.html">Sitemap</a> • <a href="https://dl.sbr.pm/">Files</a></small><br/>
72 <small class='questions'>Questions, comments ? Please use my <a href="https://lists.sr.ht/~vdemeester/public-inbox">public inbox</a> by sending a plain-text email to <a href="mailto:~vdemeester/public-inbox@lists.sr.ht">~vdemeester/public-inbox@lists.sr.ht</a>.</small><br/>
73 <small class='copyright'>
74 Content and design by Vincent Demeester
75 (<a rel='licence' href='http://creativecommons.org/licenses/by-nc-sa/3.0/'>Some rights reserved</a>)
76 </small><br />
77</footer>
78</footer>
79</body>
80</html>