A simplified Docker-like image build + container runtime system implemented in Go.
Docksmith parses a Docksmithfile, builds layered images with a deterministic cache, and runs containers using chroot-based isolation.
CLI → Parser → Builder → (Cache + Layer + Image)
↓
Runtime
- Linux or WSL2 is required (the runtime uses Linux
chroot(2)). macOS/Windows are not supported forbuild/run. - Offline only: no downloads during build or run (don’t use
apt-get,curl, etc. inRUN). - Only
COPYandRUNcreate layers. Other instructions only update build state. - Cache reporting is printed only for
COPYandRUNsteps:Step i/n : ... [CACHE HIT|MISS] X.XXs.
- Go 1.22+
- Linux machine or WSL2 (Ubuntu recommended)
sudoaccess (needed forchroot)
This repo includes a required offline sample app in sample-app/ that uses all six instructions: FROM, WORKDIR, COPY, ENV, RUN, CMD.
Use sudo for both build and run so everything is stored under the same ~/.docksmith/ location (for root).
sudo go run ./cmd base base:latestsudo go run ./cmd build -t sample:latest ./sample-appExpected behavior:
COPY→[CACHE MISS]RUN→[CACHE MISS]
sudo go run ./cmd build -t sample:latest ./sample-appExpected behavior:
COPY→[CACHE HIT]RUN→[CACHE HIT]
Create/change a temporary file in the build context, then rebuild:
date > sample-app/.demo-change.txt
sudo go run ./cmd build -t sample:latest ./sample-app(Optional cleanup)
rm -f sample-app/.demo-change.txtExpected behavior:
COPY→[CACHE MISS]RUN→[CACHE MISS](cascade)
sudo go run ./cmd run sample:latestsudo go run ./cmd run -e MESSAGE="Hi Professor" sample:latestRun a command that writes /test.txt inside the container rootfs:
sudo go run ./cmd run sample:latest sh -c 'echo hacked > /test.txt'Now check the host filesystem:
ls /test.txtExpected:
ls: cannot access '/test.txt': No such file or directory
go run ./cmd images
go run ./cmd rmi sample:latestsudo go run ./cmd build -t sample:latest --no-cache ./sample-appsudo go run ./cmd build -t test:latest .sudo go run ./cmd run test:latestsudo go run ./cmd run -e KEY=value test:latestgo run ./cmd images
go run ./cmd rmi test:latestgo test ./... -v