LayerSmith is a self-hosted web interface for building OCI container images without writing Containerfiles by hand. Pick a Linux distribution, say what the image is for, choose your tools, build it, and take away an OCI image, a TAR archive or an air-gap bundle.
The same server can be driven from a terminal on another machine: the LayerSmith terminal client brings an interactive TUI and a scriptable CLI to a jumphost or laptop, with no container runtime and no access to the container host needed.
by xnett.org
git clone https://github.com/r0lfi/layersmith.git
cd layersmith
docker compose up -d # or: podman compose up -dWith Podman directly, using its rootless socket as the build backend:
systemctl --user enable --now podman.socket
podman run -d \
--name layersmith \
--restart=unless-stopped \
-p 8080:8080 \
-v layersmith-data:/data \
-v $XDG_RUNTIME_DIR/podman/podman.sock:/var/run/docker.sock \
-e DOCKER_HOST=unix:///var/run/docker.sock \
ghcr.io/r0lfi/layersmith:latestBy design, LayerSmith has no login. It is meant to run on a machine you trust — your workstation or a host on your own network — and the mounted socket lets it run containers as the socket's owner. If you need authentication, put a proxy that provides it in front. See docs/deployment.md for setups that isolate the builder.
Writing a good Containerfile by hand means remembering that DNS tools are
bind-utils on AlmaLinux, dnsutils on Ubuntu and bind-tools on Alpine,
that apt-get needs --no-install-recommends and a cleanup afterwards, and
that a latest tag quietly changes under you. LayerSmith knows those things,
and shows you the Containerfile it produced before anything is built.
- Purpose-driven templates — Developer, Linux Admin, Network Tools, Ansible, Kubernetes, OpenShift, Minimal, or start from nothing.
- Distro-aware packages — templates ask for capabilities, and LayerSmith
translates them per distribution (
dnf/apt/apk). - Distributions — AlmaLinux, Rocky Linux, CentOS Stream, Fedora, Ubuntu, Debian, Alpine, or any other OCI base image you name.
- Generated Containerfile, shown before you build and editable if you take over in Advanced mode.
- Import an existing Dockerfile or Containerfile and build that instead.
- Custom packages, files and scripts — pre-build, post-install and entrypoint hooks.
- Immutable versioned builds — a version is built once, never overwritten, and each build records its Containerfile, base digest, package list, file checksums and log.
- Digest-pinned bases, so a rebuild does not silently follow a moved tag.
- LLM models for offline GPU hosts — download open models from Hugging Face on the Models page (with a curated list for NVIDIA H200), verified against Hugging Face's checksums and handed over in parts under 1 GB with an install script. See docs/models.md.
- GPU kit — the GPU benchmark image, chosen models,
setup.shandstart_container.shin parts under 1 GB: onebash setup.shon the GPU host checks disk space, loads the image, installs the models and starts the dashboard. - Delete builds from the Builds list: the record, its archives, log, scan results and local image go together; anything another build still uses is kept. Running builds cannot be deleted, and a build a restart interrupted is marked failed instead of showing as running forever.
- Live build logs, streamed to the browser.
- OCI TAR export with a recorded SHA256.
- Split archives — the same TAR in parts under 1 GB plus a bash-only
assemble-image.sh, for transfers that refuse large files. See docs/split-archive.md. - Air-gap bundles — image, manifest, source Containerfile,
SHA256SUMSandINSTALL.txtin one archive that loads with no network access. - Optional image scanning — pluggable, off until you configure a scanner, and it reports rather than blocks. See docs/scanning.md.
- LLM training templates — built into LayerSmith, next to the other templates: Hugging Face fine-tuning (LoRA, QLoRA, DPO), advanced PyTorch training (full fine-tuning, continued pretraining, FSDP, DeepSpeed, FlashAttention), LLaMA-Factory with its web UI, and CPU dataset preparation. Hash-locked Python stacks, checks run inside the image after each build (dependencies, CPU smoke test, offline example), and a Getting started for the exact image. See docs/training.md.
- AI / ML / GPU images — NVIDIA PyTorch (NGC 26.09, CUDA 13.4.1), NVIDIA CUDA, vLLM, TensorFlow GPU or any base: import the upstream image unchanged or add Python tools without pip replacing the base image's framework builds. A basic test runs inside every image, GPU compatibility is graded against the driver and the GPU architectures the kernels were compiled for, the export carries a CycloneDX SBOM and package list, and the build page generates Slurm batch scripts that give Podman exactly the GPUs Slurm allocated. See docs/ai-ml.md.
- OpenShift Admin Toolkit — a rootless AlmaLinux 10 admin image for
Podman and Distrobox: oc and kubectl from Red Hat's signed client release
(4.22 by default), oc-mirror, opm, operator-sdk, Helm, kustomize, k9s, stern,
kubectx/kubens, yq, podman/buildah/skopeo and ansible-core, every download
pinned by sha256. Adds
oc-status,oc-gpu,oc-aiand other helpers for OpenShift AI and NVIDIA GPU clusters, multi-cluster kubeconfigs with a production marker, anopenshift-admincommand that enters an always-running rootless container (installed byinstall-host.shorassemble-image.sh --install), and a Distrobox Assemble manifest. Checks after each build prove the tools and versions as a non-root user and that no kubeconfig or credential is in any layer. See docs/openshift-admin.md. - opencode Shared Terminal — the opencode coding agent for an air-gapped
host: one always-running container, and an
opencodecommand on the host that runs it inside as the calling user, in the directory they are in. Several users at once, each with their own sessions in their own home; no capabilities and no sudo inside. opencode and ripgrep are pinned by sha256, and update checks, model-catalogue and language-server downloads are off.install-host.shcomes with the build and sets up the command, a sudo rule for one group and a systemd unit; you put your own OpenAI-compatible endpoint (vLLM, Ollama, ...) in/etc/opencode/opencode.json. See docs/opencode.md. - NVIDIA GPU & LLM Benchmark — a Quick build that produces one offline
Podman image with an interactive terminal dashboard: live GPU status, LLM
token speed and latency with vLLM on local models, GEMM compute, memory
bandwidth, NCCL multi-GPU and multi-node (torchrun, MPI, Slurm) tests, and
HTML/JSON/CSV reports with run comparisons. Download it as one
.tar,podman loadit on the GPU server. See docs/gpu-benchmark.md. - Podman or Docker as the build backend.
- Terminal client —
layersmithon any machine with Python 3.9+: an interactive TUI (projects, wizards, live logs, scans, exports) and a CLI with JSON output for scripts. Builds keep running on the server when the client disconnects; downloads land on your machine, checked against the server's SHA256. See docs/client.md. - API first — the web UI and the terminal client use the same HTTP API you can script against.
| Dashboard | Create image wizard |
|---|---|
![]() |
![]() |
| Live build log | Build and image details |
|---|---|
![]() |
![]() |
Every finished image is scanned, if you configure a scanner. Severity counts filter the findings; a secret is reported as a rule, a file and a line, never as the value:
This is part of LayerSmith, not a separate product or image: the same LayerSmith container you already run offers it as another category in the Create image wizard, next to Developer, Ansible and the rest. What it builds is an ordinary image of yours, like any other LayerSmith build.
Building a training environment for a machine without internet access is mostly about getting a long list of versions to agree - PyTorch and its CUDA build, Transformers, PEFT, TRL, bitsandbytes, DeepSpeed - and then proving the result works before it leaves the connected side. Choose Create image → LLM Training & Fine-tuning.
- Four profiles — Hugging Face fine-tuning (LoRA, QLoRA, DPO; recommended), advanced PyTorch training (full fine-tuning, continued pretraining, FSDP, DeepSpeed, FlashAttention), LLaMA-Factory with its web UI, and CPU-only dataset preparation.
- Start from the purpose — training task, adaptation method and where it runs; LayerSmith suggests a profile and explains every tool it includes.
- Locked, not latest — base images pinned by digest, Python packages installed from hash-locked files, one consistent resolution per stack. Incompatible choices are refused before the build, with a working alternative.
- Checked offline — after each build the image is tested with networking disabled: locked versions and imports, a CPU training step on a tiny local model, and the bundled examples (SFT, resume from checkpoint, DPO). No GPU is needed to build or check.
- An export you can carry in — the air-gap bundle adds a README with Docker and Podman commands for that exact image, the locks, examples, check results, and a list of what to bring separately (model weights, data).
| Choose a purpose and profile | See what is included, and why |
|---|---|
![]() |
![]() |
| Review versions and the Containerfile | Checks run inside the image |
|---|---|
![]() |
![]() |
Profiles, versions, measured image sizes and the offline workflow: docs/training.md.
Dashboard → Quick build → NVIDIA GPU & LLM Benchmark opens a wizard for a versioned benchmark image (CUDA 13.0 + PyTorch 2.11 + vLLM 0.26 by default, for Hopper and Blackwell GPUs). The finished build offers Download Podman Image (.tar) with its SHA-256. On the GPU server:
podman load -i gpu-benchmark-1.0.0.tar
podman run --rm -it --device nvidia.com/gpu=all --security-opt=label=disable --shm-size=16g \
-v /models:/models:ro -v /opt/gpu_benchmark/results:/results localhost/gpu-benchmark:1.0.0The terminal dashboard starts and runs every benchmark against the GPUs and
local models in front of it, with no network access. The same gpu-bench
CLI drives scripted and Slurm runs. The image has CUDA user space only; the
host provides the NVIDIA driver and Container Toolkit (CDI). The
guide covers metrics, the version matrix, RDMA/RoCE,
NCCL settings, Slurm and comparisons.
LayerSmith can also be used from a terminal on another machine - a jumphost, a laptop, an admin server - through the same API as the web UI. A project created in the terminal shows up in the browser and the other way round.
layersmith config set server https://layersmith.example.org
layersmith # interactive terminal interface
layersmith projects list # or the command line, for scripts
layersmith build my-image --follow
layersmith export 12 --output ./image.tar
layersmith --json builds list # machine-readable output- Interactive TUI — dashboard, projects with details and the live log of
their latest build, the image and LLM training wizards, builds, scans,
exports and settings. Keyboard driven, works at 80x24, needs no special
font, and every status is a word as well as a colour (
NO_COLORworks). - CLI for scripts — every web UI function as a command,
--jsonand JSON Lines for followed jobs, documented exit codes, no prompts without a terminal,--yesfor destructive actions. - Remote by design — local files are uploaded, downloads stream to your
machine and are verified; a lost connection never looks like a finished
build, and
layersmith builds wait <id>re-attaches to one that is still running. - Safe on the network — TLS always verified (internal CA supported), HTTP Basic or client certificates for an authenticating proxy, no credentials on the command line.
Install. The client is a separate, pure-Python package
(layersmith-client, Python 3.9+, no server or container tools). Each
GitHub Release from v0.5.0 on
carries the wheel and an offline archive with every dependency for Python
3.9-3.13; it is not on PyPI. On the client machine:
curl -LO https://github.com/r0lfi/layersmith/releases/download/v0.8.6/layersmith-client-0.8.6-offline.tar.gz
tar -xzf layersmith-client-0.8.6-offline.tar.gz && cd layersmith-client-0.8.6-offline
sha256sum -c SHA256SUMS
pipx install --pip-args="--no-index --find-links=$PWD/wheelhouse" layersmith-client
layersmith config set server https://layersmith.example.org
layersmith doctorFull guide: docs/client.md · what the terminal covers of the web UI: docs/client-features.md.
The documentation keeps these apart, and so should you:
| Term | Meaning |
|---|---|
| LayerSmith application image | ghcr.io/r0lfi/layersmith — LayerSmith itself, published by this repository |
| Built image | an image a LayerSmith user creates through the web UI |
| Tag | Meaning |
|---|---|
0.8.6 |
an exact release — recommended for production |
0.2, 0 |
newest patch within that minor/major line |
latest |
newest stable release |
edge |
built from main on every merge; development, not stable |
services:
layersmith:
image: ghcr.io/r0lfi/layersmith:0.8.6Prereleases (v0.2.0-rc1) publish only their exact tag; they never move
latest.
LayerSmith serves the web application; the actual image building is done by a container runtime. Supported combinations:
| Running LayerSmith | Build backend | Notes |
|---|---|---|
| Container (Docker) | Docker socket mounted | What compose.yml does |
| Container (Podman) | rootless Podman socket mounted | Mount it at /var/run/docker.sock; the API is compatible |
| Directly on a host | that host's Podman or Docker | Most isolation, no socket mount |
The application image carries a Docker client only, which also drives a Podman
socket. Running LayerSmith directly on a host uses that host's own client and
can use Podman natively. LAYERSMITH_BUILD_BACKEND accepts auto, podman
or docker; the Settings page shows what was detected.
A socket mount is deliberate, not accidental: whoever can reach LayerSmith can
run containers as the socket's owner. docs/deployment.md describes the
alternatives.
Everything is optional; see .env.example for the full list.
| Variable | Default | Purpose |
|---|---|---|
LAYERSMITH_DATA_DIR |
/data |
Everything LayerSmith keeps, including the database |
LAYERSMITH_IMAGE_DIR |
$DATA/images |
Exported archives and air-gap bundles |
LAYERSMITH_BUILD_DIR |
$DATA/builds |
Build contexts |
LAYERSMITH_UPLOAD_DIR |
$DATA/uploads |
Uploaded files |
LAYERSMITH_LOG_DIR |
$DATA/logs |
Build logs |
LAYERSMITH_TMP_DIR |
$DATA/tmp |
Scratch space |
LAYERSMITH_SCAN_DIR |
$DATA/scans |
Scan reports and SBOMs |
LAYERSMITH_DATABASE_URL |
sqlite:///$DATA/layersmith.db |
Any SQLAlchemy URL |
LAYERSMITH_BUILD_BACKEND |
auto |
auto, podman or docker |
LAYERSMITH_DEFAULT_ARCH |
amd64 |
Architecture offered first |
LAYERSMITH_DEFAULT_NAMESPACE |
layersmith |
Namespace for new image names |
LAYERSMITH_MAX_UPLOAD_BYTES |
512 MiB | Largest accepted upload |
LAYERSMITH_MAX_FILES_PER_IMAGE |
100 |
Files and tools one image may reference |
LAYERSMITH_MAX_CONTEXT_BYTES |
2 GiB | Largest build context |
LAYERSMITH_SCANNER |
auto |
Image scanner: auto, none, or a scanner name |
LAYERSMITH_SCAN_AFTER_BUILD |
1 |
Scan each image once it is built |
LAYERSMITH_SCAN_KINDS |
vulnerability,secret |
What a scan looks for |
LAYERSMITH_GENERATE_SBOM |
1 |
Produce a CycloneDX SBOM with a scan |
LAYERSMITH_SPLIT_PART_BYTES |
900000000 |
Part size of a split archive (at most 900 MB) |
LAYERSMITH_MODEL_DIR |
$DATA/models |
Downloaded LLM models |
LAYERSMITH_HF_ENDPOINT |
https://huggingface.co |
Where models are downloaded from |
The seven paths under the data directory are also editable at runtime in Settings → Storage. A value set in the environment wins and is shown read-only there. Changing a path never moves existing files, and archives written earlier stay downloadable.
All state lives under /data: the database, exported images, build contexts,
uploads and logs. Keep that volume and an upgrade keeps your projects, build
history and archives.
docker compose pull && docker compose up -dpodman pull ghcr.io/r0lfi/layersmith:latest
podman rm -f layersmith
# then re-run your original podman run commandBack up the volume the ordinary way; /data is all there is.
- Backend — FastAPI, SQLite by default, one build worker thread.
- Frontend — React and Vite, served by the backend on the same port.
- Terminal client —
client/, a separate package with a CLI and a Textual TUI. It uses only the HTTP API, like the web UI. - Build backends — a small interface (
available,resolve_base,build,inspect,export,remove) with Podman and Docker implementations, so a remote build agent can be added without touching the rest. - Scanners — the same arrangement for image scanning (
available,health,version,database_info,scan_image,generate_sbom), with no scanner configured by default.
LayerSmith runs build jobs, so it is treated as security-sensitive:
- Commands are built as argv lists; no user value is interpreted by a shell.
- Image references, package names, paths, versions and environment variable names are matched against explicit patterns before use.
- Uploaded files are content-addressed and re-verified by checksum before entering a build context.
- Environment variables that look like credentials are refused: secrets must not be baked into an image.
- Downloads are limited to directories LayerSmith itself writes to.
- Uploaded files are refused if they are links, and a build context is bounded in file count and total size.
- An unknown
/api/path answers as the API, so a mistyped endpoint cannot be mistaken for a working one. - Image scanning, when configured, is handed an exported archive rather than the container runtime's socket, in a container with every capability dropped and one read-only mount.
- Secret findings record a rule, a file and a line - never the value - and the image's build history is stripped from a stored scan report.
An image LayerSmith has not scanned is reported as unknown, never as clean; see docs/scanning.md.
Deliberate boundaries, in full in docs/deployment.md: no built-in authentication (run it somewhere you trust, or front it with a proxy); a build runs code you supply; nothing is garbage collected; no quotas; one build at a time.
LayerSmith is scanned by its own CI on every push and weekly: dependencies, the repository's whole history for secrets, and the published application image. See SECURITY.md, and report vulnerabilities privately.
cd backend
python3 -m venv .venv && .venv/bin/pip install -e '.[dev]'
.venv/bin/pytest # no container runtime needed
.venv/bin/uvicorn layersmith.api:create_app --factory --reload --port 8080
cd ../frontend
npm install && npm run dev # proxies /api to port 8080See CONTRIBUTING.md for the longer version, and docs/RELEASING.md for how releases are cut.
MIT — see LICENSE.












