Docker from scratch image of Tinycore Linux
To build on top of it, just pull from the docker-tinycore package
echo FROM ghcr.io/innovarew/docker-tinycore > Dockerfile
docker build -t docker-tinycore-scratch .
To run, just docker run
as show below:
sudo docker run -it ghcr.io/innovarew/docker-tinycore:latest
To build locally, just make
as show below:
# prepare the rootfs, build, and run the container
sudo make TC_URL=http://tinycorelinux.net/15.x/x86_64/
Ready to use docker images from docker-tinycore (see link on how-to use):
Release/Arch | Docker Image |
---|---|
latest | FROM ghcr.io/innovarew/docker-tinycore:latest |
15.x-x86_64 | FROM ghcr.io/innovarew/docker-tinycore:15.x-x86_64 |
14.x-x86_64 | FROM ghcr.io/innovarew/docker-tinycore:14.x-x86_64 |
14.x-x86 | FROM ghcr.io/innovarew/docker-tinycore:14.x-x86 |
13.x-x86_64 | FROM ghcr.io/innovarew/docker-tinycore:13.x-x86_64 |
12.x-x86_64 | FROM ghcr.io/innovarew/docker-tinycore:12.x-x86_64 |
11.x-x86_64 | FROM ghcr.io/innovarew/docker-tinycore:11.x-x86_64 |
10.x-x86_64 | FROM ghcr.io/innovarew/docker-tinycore:10.x-x86_64 |
What goes on under the hood is shown below:
cat > Dockerfile <<EOF
FROM scratch
ADD data/rootfs-x86_64-15.x.tar.xz /
EOF
# unpack tinycore rootfs, sudo needed to unpack cpio proper perms
sudo scripts/tc-docker tce_rootfs_init data/
# build and run the tinycore docker container
sudo docker build -t docker-tinycore-local:latest .
sudo docker run -it docker-tinycore-local:latest /bin/sh
tc-docker
provides the main functionalities for running tinycore on docker:
-
First, provides
tc-docker tce_rootfs_init
that extracts the rootfs of a tinycore ISO image. This rootfs, can then be used on aDockerfile
, usingFROM scratch
and adding the rootfs. -
Second, provides
tc-docker tce_install ext.tcz root/
, that fetches a ext.tcz and unpacks it underroot/
. This allows to installsquashfs-tools.tcz
, so the running container can useunsquashfs
to install tcz extensions into the designatedroot/
. -
Last, once tinycore
rootfs
, and,unsquashfs
are in place inside the container, thetce-load -wi whois
command can be used on the running container to install new extensions.
One limitation of this approach is that if for any reason the unsquashfs
stops working, say squashfs-tools.tcz
or any of its dependences is removed then, tce-load
stops working, and the ability of installing new tce extensions is lost.
A benefit of using the TinyCore ISO image as source, is that extensions shipped inside the TinyCore ISO under <iso>/cde
are available, and can be provided as a docker volume to be used for shipping as offline extensions without requiring download.