Manage Debian Linux dev containers with a per-directory persistent home. The container holds the tools; each directory you start padded-cell from gets its own container and its own private home that survives every rebuild. The container persists after you exit and is reused next time. Works on macOS and Linux with Docker or Podman.
Each starting directory gets its own private home under ${XDG_STATE_HOME:-~/.local/state}/padded-cell, named <dir>-YYYYMMDDHHMMSS. The mapping from start path to home is recorded in index.tsv, so the same starting path always reuses the same home (different paths sharing a basename never collide). The container's name and hostname both match the home name, and the starting directory is bind-mounted into the container home under its own basename (e.g. starting in /Users/me/foo mounts it at /home/<user>/foo). None of this is configurable. padded-cell refuses to run from / or your home directory; run it from a project directory.
Because the container name is derived from the starting path, re-running padded-cell run from the same directory reuses that container: if it is still running you get another shell inside it; if it has stopped it is resumed. Resuming a stopped container replays its original command, so a different command passed on resume is ignored (remove the container with docker rm <name> / podman rm <name> to recreate it). The container is not removed on exit; to make it ephemeral instead, add --rm to EXTRA_RUN_ARGS.
Because reuse skips creation, create-time settings (EXTRA_MOUNTS, EXTRA_RUN_ARGS, mounts, hostname) only apply when the container is first created. Change them, then remove the container to recreate it with the new settings. Two simultaneous first runs from the same directory race to create the container; one wins and the other fails with a name-in-use error — just re-run it to join the winner.
git clone <this repo>
cd padded-cell
./padded-cell install
# then restart your shell, or source the rc file install reports (e.g. ~/.zshrc or ~/.bashrc)Run once after install. Re-run when you change build-affecting config
(PACKAGES, DEBIAN_SUITE, USERNAME, UID_OVERRIDE/GID_OVERRIDE, TZ,
LOCALE, EXTRA_BUILD_ARGS), or to refresh the image with newer packages.
padded-cell buildRebuilds reuse Docker's layer cache, so a plain padded-cell build can reuse
the cached package layer and the cached base image without pulling anything
newer. To force a clean refresh (for example to pick up security updates or a
newer Debian testing snapshot), clear the cache with --pull --no-cache.
Set it in ~/.config/padded-cell.conf (an inline EXTRA_BUILD_ARGS=... padded-cell build
will NOT work — the config loader resets the variable before sourcing the file):
EXTRA_BUILD_ARGS=(--pull --no-cache)Then run padded-cell build. --pull re-fetches the base image; --no-cache
rebuilds every layer so apt installs the latest packages. Revert it afterwards
for fast cached rebuilds.
padded-cell run # interactive shell
padded-cell run nvim # run a command directly
padded-cell run -- ls -la # pass flags to the commandThe container persists after you exit and is reused on the next padded-cell run from the same directory (a running container gets another shell via exec; a stopped one is resumed). See Home directories for the reuse and naming details, and EXTRA_RUN_ARGS below to opt into ephemeral (--rm) containers.
The config file lives at ~/.config/padded-cell.conf. On first install, padded-cell copies padded-cell.conf.example there. Every key is optional; defaults apply when unset. The file is plain Bash and is sourced directly.
| Key | Default | Description |
|---|---|---|
USERNAME |
id -un (host login) |
Username inside the container. |
UID_OVERRIDE |
(host UID) | Override the UID used inside the container. |
GID_OVERRIDE |
(host GID) | Override the GID used inside the container. |
LOCALE |
C.UTF-8 |
Locale set inside the container. |
TZ |
America/Denver |
Timezone set inside the container. |
DEBIAN_SUITE |
testing |
Debian image tag to build from. Full image by default (keeps man pages + docs). Append -slim (e.g. testing-slim) for a smaller image that strips man pages/docs/locales, including for packages installed later. |
IMAGE |
padded-cell |
Name (and optional tag) of the built image. |
RUNTIME |
(auto) | Runtime flavor. Values: docker-desktop, colima, docker, podman, podman-machine. Leave empty to auto-detect (precedence: docker > podman; on macOS the active Docker context is inspected to distinguish colima vs docker-desktop). |
COLIMA_PROFILE |
default |
Colima profile name. Used only when RUNTIME=colima. |
PODMAN_MACHINE |
podman-machine-default |
Podman machine name. Used only when RUNTIME=podman-machine. |
PACKAGES |
(see example) | Bash array. The user toolchain installed on top of the base image. Base packages (bash, ca-certificates, tzdata, ncurses-term, sudo) are baked into the Dockerfile and not listed here. |
EXTRA_MOUNTS |
(none) | Bash array of host:container path pairs for extra bind mounts. Applied only when the container is created; to add or change mounts on an existing per-directory container, remove it first. |
EXTRA_BUILD_ARGS |
(none) | Bash array of raw flags appended to the image build. Set (--pull --no-cache) to force a clean image refresh (see Refreshing the image). |
EXTRA_RUN_ARGS |
(none) | Bash array of raw flags appended to container creation, e.g. (-e VAR=val), (-p 8080:8080), (--network=host). Each flag/value is a separate element. Add --rm to make the container ephemeral (removed on exit) instead of persistent. Applied only when the container is created; to change them, remove the container first. |
| Provider | macOS | Linux | Notes |
|---|---|---|---|
docker-desktop |
yes | yes | Auto-started if installed and stopped. |
colima |
yes | no | Auto-started if installed and stopped. One-time setup required. |
docker (native) |
no | yes | Must be running as a system service. |
podman |
no | yes | Rootless. Auto-detects whether --userns=keep-id is needed. |
podman-machine |
yes | no | Auto-started if installed and stopped. One-time setup required. |
Auto-detect precedence: docker > podman. Force a specific provider with RUNTIME=<value>.
padded-cell only starts an existing VM. It never creates or configures one. Run these commands once yourself before using padded-cell with colima or podman-machine.
# colima (recommended for macOS):
colima start -p default --cpu 4 --memory 8 --vm-type=vz --mount-type=virtiofs
# podman machine:
podman machine init podman-machine-default
podman machine start podman-machine-defaultpadded-cell never installs or modifies host software. If a required runtime or VM provider is not installed, padded-cell exits with guidance. Install the runtime yourself.
Run shellcheck padded-cell lib/*.sh before submitting.