workstation/docs/CustomDebianContainer.html

32 lines
977 B
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>Custom Debian container</title>
</head>
<body>
<h1>Custom Debian container</h1>
<p>Debian containers can be easily built using <code>debootstrap</code> to create a basic Debian chroot, which can then be cleaned up and <em>tar</em>ed to add to a Containerfile.</p>
<p>The following is the process:</p>
<pre><code>sudo apt-get install debootstrap
sudo mkdir -p /opt/mydebian/rootfs
cd /opt/mydebian
sudo debootstrap stable ./rootfs http://deb.debian.org/debian
sudo rm -fr ./rootfs/debootstrap
sudo rm -fr ./rootfs/var/cache/*
sudo rm -fr ./rootfs/var/lib/apt/lists/*
sudo tar czf rootfs.tar.gz -C ./rootfs .
cat &lt;&lt; __EOF__ | sudo tee Containerfile
FROM scratch
2023-03-21 14:41:20 +00:00
ADD rootfs.tar.gz /
CMD [&quot;/bin/bash&quot;]
__EOF__
podman build -t mydebian:latest .</code></pre>
<p>This will create a podman image tagged <code>mydebian:latest</code> with the current <em>stable</em> packages.</p>
</body>
</html>