Tech/Basics/Container

From lathama
< Tech‎ | Basics
Jump to navigation Jump to search

Introduction

Modern development processes use the idea of a container a lot. Containers are just tarballs that hold structure for a system. Containers can be managed with many tools. Think of containers like User Mode Linux from the 2000s. Today many people use tools like Docker, OCI, Kubernetes and more to manage their tarballs, er containers.

Bare minimum

The fastest bare minimum system can look like this done on a Debian 12 Bookworm system:

mkdir -p ~/code/bareminimum/basedir
cd ~/code/bareminimum
apt-get download base-files ca-certificates netbase libbz2-1.0 libc6 libdb5.3 libexpat1 libffi8 liblzma5 libncursesw6 libpython3.11-minimal libpython3.11-stdlib libreadline8 libsqlite3-0 libssl3 libtinfo6 libtirpc3 libuuid1 media-types openssl python3.11-minimal tzdata zlib1g
for f in *.deb; do dpkg -x $f basedir/; done
tar -C basedir -c . | docker import - lathamatest

And lets have a look

docker inspect lathamatest | grep -i size
        "Size": 49266568,
        "VirtualSize": 49266568,
docker run -it lathamatest /usr/bin/python3.11
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World")                                                                                                                                                             
Hello World
>>>

Resources