<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Raymond P. Burkholder - Things I Do - Containers</title>
    <link>http://blog.raymond.burkholder.net/</link>
    <description>In And Around Technology and The Arts</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.7.2 - http://www.s9y.org/</generator>
    <pubDate>Sun, 12 Apr 2026 03:45:08 GMT</pubDate>

    <image>
        <url>http://blog.raymond.burkholder.net/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: Raymond P. Burkholder - Things I Do - Containers - In And Around Technology and The Arts</title>
        <link>http://blog.raymond.burkholder.net/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>LXC Fresh Container Construction From Scratch for Proxmox</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/1335-LXC-Fresh-Container-Construction-From-Scratch-for-Proxmox.html</link>
            <category>Containers</category>
            <category>Debian</category>
            <category>LXC</category>
            <category>Proxmox</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/1335-LXC-Fresh-Container-Construction-From-Scratch-for-Proxmox.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=1335</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=1335</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;There are many articles available which discuss customizing a pre-existing Proxmox Container Template.  Few, if any, discuss constructing an LXC container from scratch.  Maybe because, fundamentally, a container template is just the rootfs as tarball, so building it is quite easy:

&lt;ul&gt;
  &lt;li&gt;Build a linux based virtual machine, I use Debian&#039;s recent release
  &lt;li&gt;Install LXC and its template package
  &lt;li&gt;Construct and initialize an LXC container
  &lt;li&gt;Shut it down and and zip it up
  &lt;li&gt;Copy it over to the ProxMox template directory
  &lt;/ul&gt;

&lt;p&gt;The details:

&lt;blockquote&gt;&lt;pre&gt;
# build the linux vm - details not relevant here
# ssh into the vm, or start a command line
# install basic packages

sudo apt install --no-install-recommends lxc lxc-templates xz-utils bridge-utils wget debootstrap rsync

# basic container templates are in:
#   /usr/share/lxc/templates/ 
# for debian as well as other distributions

# create an lxc container, provide a list any additional packages

lxc-create --template debian --name trixie-template -- --release trixie --packages iputils-ping,vim-tiny

# start and attach to the container
lxc-start trixie-template
lxc-attach trixie-template

# prepare for generating template
apt clean
apt purge

# Remove SSH host keys to ensure unique keys for each clone:
rm /etc/ssh/ssh_host_*

# Empty the machine ID file:
truncate -s 0 /etc/machine-id

# clear history
unset HISTFILE
# truncate history
history -c
&gt; ~/.bash_history
# the following has a space in front to prevent inclusion in the history
 shutdown -h now

# the shutdown returns to the virtual machine&#039;s prompt
# compress the directory structure

cd /var/lib/lxc/trixie-template/

# remove /dev files as they can&#039;t be created in an unprivileged container
# an example error message if not removed:
#   tar: ./rootfs/dev/urandom: Cannot mknod: Operation not permitted
# construction of a new container will re-create the directory and files

rm ./rootfs/dev/ptmx
rm ./rootfs/dev/zero
rm ./rootfs/dev/tty3
rm ./rootfs/dev/urandom
rm ./rootfs/dev/null
rm ./rootfs/dev/tty
rm ./rootfs/dev/console
rm ./rootfs/dev/tty4
rm ./rootfs/dev/tty2
rm ./rootfs/dev/random
rm ./rootfs/dev/tty1
rm ./rootfs/dev/full

# cd into rootfs and zip the container

cd rootfs
tar --xz --acls --numeric-owner -cf /var/local/trixie-13-3-template.tar.xz ./

# the xz file can be copied over to proxmox and placed into
# /var/lib/pve/local-btrfs/template/cache/
# for use as a template for container creation
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;During the first use of lxc-create to create the original container, packages are downloaded and installed to build the container.
The packages and installation is cached for faster subsequent builds of the same container type.

&lt;p&gt;If the cache becomes stale, it can be rebuilt by using --flush-cache in a manner similar to:

&lt;blockquote&gt;&lt;pre&gt;
lxc-create --template debian --name trixie-template -- --release trixie --flush-cache --packages iputils-ping,vim-tiny,less,python-minimal
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;An existing cache can be updated with something like:

&lt;blockquote&gt;&lt;pre&gt;
sudo chroot /var/cache/lxc/debian/rootfs-trixie-amd64
apt-get update
apt-get dist-upgrade
apt-get clean
exit
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;courtesy of &lt;a href=&quot;https://www.tomechangosubanana.com/2015/updating-lxc-imagecontainer-caches/&quot; target=_blank&gt;Updating lxc image/container caches&lt;/a&gt;

&lt;p&gt;One other note, there are two package candidates for installing the &lt;a href=&quot;https://unix.stackexchange.com/questions/400351/what-are-the-differences-between-iputils-ping-and-inetutils-ping&quot; target=_blank&gt;ping utility&lt;/a&gt;:

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://packages.debian.org/trixie/iputils-ping&quot; target=_blank&gt;iputils-ping&lt;/a&gt; - native Linux ping, preferred for Debian/Linux
  &lt;li&gt;&lt;a href=&quot;https://packages.debian.org/trixie/inetutils-ping&quot; target=_blank&gt;inetutils-ping&lt;/a&gt; - general gnu version, used on a variety of posix sytstems, less preferred
  &lt;/ul&gt;

&lt;p&gt;Some fix-ups in the process:

&lt;ul&gt;
  &lt;li&gt;apt-get install less
  &lt;li&gt;dpkg-reconfigure locales
  &lt;li&gt;useradd user
  &lt;/ul&gt;

 
    </content:encoded>

    <pubDate>Fri, 27 Feb 2026 21:03:19 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/1335-guid.html</guid>
    
</item>
<item>
    <title>Image Building Notes - debootstrap</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/1348-Image-Building-Notes-debootstrap.html</link>
            <category>Containers</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/1348-Image-Building-Notes-debootstrap.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=1348</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=1348</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;APT based distributions like Debian can be containerized with a tool called &lt;a href=&quot;https://packages.debian.org/stable/debootstrap&quot; target=_blank&gt;debootstrap&lt;/a&gt;.  It is part of the image build process of lxc-create.  It is also referenced in Docker &lt;a href=&quot;https://docs.docker.com/build/building/base-images/&quot; target=_blank&gt;Base Images&lt;/a&gt; for building an image from scratch.

&lt;p&gt;When looking at the build scripts included in the package installation, repositories for the following distributions can be found in /usr/share/debootstrap/scripts:

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.debian.org/&quot; target=_blank&gt;debian&lt;/a&gt; - universal operating system
  &lt;li&gt;&lt;a href=&quot;https://trisquel.info/&quot; target=_blank&gt;trisquel&lt;/a&gt; - a distribution of the GNU operating system, with the kernel GNU &lt;a href=&quot;https://www.fsfla.org/ikiwiki/selibre/linux-libre/&quot; _target=_blank&gt;Linux-libre&lt;/a&gt;
  &lt;li&gt;&lt;a href=&quot;https://ubuntu.com/&quot; target=_blank&gt;ubuntu&lt;/a&gt; - modern enterprise open source
  &lt;li&gt;&lt;a href=&quot;https://pardus.org.tr/en&quot; target=_blank&gt;pardus&lt;/a&gt; - Turkish 
  &lt;li&gt;&lt;a href=&quot;https://www.kali.org/&quot; target=_blank&gt;kali&lt;/a&gt; - open-source, Debian-based Linux distribution geared towards various information security tasks, such as Penetration Testing, Security Research, Computer Forensics and Reverse Engineering
  &lt;li&gt;&lt;a href=&quot;https://elxr.org/&quot; target=_blank&gt;elxr&lt;/a&gt; - Enterprise-Grade Linux for Edge-to-Cloud Deployments
  &lt;li&gt;&lt;a href=&quot;https://pureos.net/&quot; target=_blank&gt;pureos&lt;/a&gt; - fully-convergent, user friendly, secure and freedom respecting OS for your daily usage  &lt;/ul&gt;

&lt;p&gt;The &lt;a href=&quot;https://wiki.debian.org/Debootstrap&quot; target=_blank&gt;wiki&lt;/a&gt; shows a simple two liner to get the basics of the distribution in place (as root):

&lt;blockquote&gt;&lt;pre&gt;
mkdir trixie-chroot
debootstrap stable trixie-chroot http://deb.debian.org/debian/
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;Enter the chroot and note new root:

&lt;blockquote&gt;&lt;pre&gt;
root@test:~# pwd
/root
root@test:~# chroot trixie/
root@test:/# pwd
/
root@test:/# exit
exit
root@test:~# pwd
/root
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;After the debootstrap, create the base for docker, and give it a try:

&lt;blockquote&gt;&lt;pre&gt;
tar -C trixie-chroot -c . | docker import - trixie
docker run trixie cat /etc/debian_version
docker run --rm -i -t trixie /bin/bash
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;Although debootstrap can be used to build an image for a version subsequent, it is generally recommended to use debootstrap from at least the desired version to ensure it has the proper updates and dependencies.

&lt;p&gt;Command line to summarize the referenced repositories:

&lt;blockquote&gt;&lt;pre&gt;
grep -h default_mirror /usr/share/debootstrap/scripts/* \
  | sed &#039;s/default_mirror//&#039; \
  | sed &#039;s/[ \t]//g&#039; \
  | sort \
  | uniq
&lt;/pre&gt;&lt;/blockquote&gt; 
    </content:encoded>

    <pubDate>Sun, 05 Apr 2026 17:31:32 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/1348-guid.html</guid>
    
</item>

</channel>
</rss>
