cdebug with Docker: Debug Distroless and Scratch Containers That Have No Shell (Linux, Windows, Mac)
Before you start
- 24 min read
Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#
cdebug is a small, free command-line tool that starts a short-lived helper container next to a running container and lets you work inside the target's files and process list, even when the target is a distroless or scratch image with no shell, no ls and no package manager.

Logo: cdebug has no logo of its own. This is its official README diagram (github.com/iximiuz/cdebug, file assets/images/cdebug-exec.png at tag v0.0.19), Apache-2.0. The diagram still lists uts as shared; the code at v0.0.19 no longer does that (see Security).
Small images are good: less to patch, less to attack (see our distroless and Wolfi guide). The price: docker exec -it <name> sh stops working. cdebug fixes that without rebuilding or restarting anything, and can open a port for a container that publishes none.
| What | Value (official sources, read 5 December 2026) |
|---|---|
| Current version | v0.0.19, released 18 January 2026 (previous: v0.0.18, 13 April 2024) |
| Install | Linux and Mac binary or Homebrew. No Windows build: use WSL 2 |
| Helper image | busybox:musl by default (about 0.85 MiB compressed, amd64) |
| Download size | About 15 MiB (Linux amd64 release file) |
| Time needed | About 30 minutes (our estimate, not measured) |
| Ports | None, unless you ask for one with port-forward |
| Licence | Apache-2.0 (GitHub API and LICENSE at the tag) |
| Official docs | The README at v0.0.19. There is no docs site |
At a glance:
- What it is: one static Go program on your machine. It talks to Docker through the Docker socket.
cdebug exec: a shell, or one command, inside a running container that has no shell.cdebug port-forward: a port on127.0.0.1for a container that publishes none.- Also works with: containerd, nerdctl and Kubernetes pods. We teach Docker.
Is it maintained? Be honest with yourself. The README calls it a "pre-alpha with no sound design yet" (version 0.0.x). In issue 81 (October 2025) the maintainer wrote that development was "de facto on pause". He then released v0.0.19 in January 2026, after 21 months without a release. On 5 December 2026 the last commit is from 18 January 2026, and two pull requests opened since (May and November 2026) have no reply. We found no new bug report against v0.0.19. It works today; do not plan on a fix.
How it fits together#
You run cdebug on your machine. It asks Docker to start a helper container that joins the target's network and process view; the helper then looks at the target's files through /proc and gives you a shell with its own busybox tools. The target keeps running.
Drawn for this guide from the official README and the source code at v0.0.19.
Three words. A sidecar is the helper container. A namespace is a container's view of the system (its network, its process list). chroot makes a process treat a folder as its root. The trick: the sidecar sees the target's processes, so it reaches the target's root at /proc/1/root, links its own /bin there, appends that to PATH and runs chroot into it. You stand in the target's files with busybox tools on your PATH.
Before you start#
Note: every domain, name and path on this page is a dummy example (like
app.example.comand<your-user>). Replace it with your own. The only real values are public ones: image names, versions and one image digest.
| System | What to have |
|---|---|
| Linux | Docker Engine, your user allowed to use Docker (or sudo), curl, tar. amd64 or arm64 |
| Windows | Docker Desktop with WSL 2, and a WSL 2 Linux distribution to run cdebug in (no Windows build) |
| Mac | Docker Desktop (Intel or Apple Silicon), Homebrew or curl |
docker --version docker compose version
Checklist:
- [ ] Both commands print a version, and
docker psworks (on Windows: inside WSL 2 too) - [ ] Internet access: cdebug pulls a helper image the first time
- [ ] You are allowed to debug the container. cdebug gives root-level access to it
Tested by DIY Lab Hub: not yet. Commands come from the README, the source at v0.0.19 and the Docker docs (5 December 2026). We did not run them. Output blocks are marked "expected" or come from the README.
Tip: Practise on a throwaway container. The helper runs as root in the target's namespaces.
LLM Guide: let your AI assistant set it up#
Prefer to let an AI do the typing? Copy the block below into ChatGPT, Claude, Gemini or a local model. It first asks about your setup (system, Docker, which container to debug), then follows only the path that fits you. It uses the same pinned version as this guide. You still read each command before you run it.
You are my assistant for installing cdebug (a small command-line tool that opens a shell in a running Docker container that has no shell, such as a distroless or scratch image) and for using it safely.
Follow the DIY Lab Hub guide https://diylabhub.com/cdebug/ (checked 5 December 2026).
Work one step at a time. Before each command, say in one line what it does. Wait for my OK before anything that deletes data, stops a container, or installs into a system folder.
STEP 0 - FIND OUT MY SETUP. Ask me these questions (or have me run the read-only checks) before you do anything else:
1. Which system: Linux (which distribution, amd64 or arm64), Windows or Mac (Intel or Apple Silicon)? cdebug has no Windows build, so on Windows it runs inside WSL 2.
2. Is Docker installed and working? Check: docker --version, docker compose version and docker ps (on Windows: inside WSL 2 as well, with Docker Desktop > Settings > Resources > WSL Integration switched on; check WSL 2 with wsl -l -v).
3. Does docker ps need sudo on my machine? Then cdebug needs sudo too.
4. Do I want to practise on the guide's throwaway container first, or debug a container I already run? If it is a real container, which one, and am I allowed to get root-level access to it?
5. Do I need a port forwarded from a container that publishes none?
THEN FOLLOW THE MATCHING PATH:
- Docker missing: install Docker Engine (Linux) or Docker Desktop (Windows/Mac) from docs.docker.com first, then come back.
- Linux: download the pinned release v0.0.19 for my architecture and check its SHA-256 sum before installing (commands below).
- Windows: open the WSL 2 terminal with wsl and run the Linux commands there. Every cdebug command runs inside WSL.
- Mac: brew install cdebug (the formula was at 0.0.19 on 5 December 2026). Without Homebrew use the Linux commands with darwin instead of linux, ARCH=arm64 on Apple Silicon and shasum -a 256 -c -. If cdebug cannot find Docker's socket, turn on "Allow the default Docker socket to be used" in Docker Desktop, or: export DOCKER_HOST="unix://$HOME/.docker/run/docker.sock"
- cdebug reads the Docker address from DOCKER_HOST, not from docker context.
- This is a command-line tool with no web page, so there is no reverse proxy, Traefik or Caddy step.
THE INSTALL COMMANDS (Linux, and inside WSL 2 on Windows):
VERSION=v0.0.19
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
cd "$(mktemp -d)"
curl -fsSLO "https://github.com/iximiuz/cdebug/releases/download/${VERSION}/cdebug_linux_${ARCH}.tar.gz"
curl -fsSLO "https://github.com/iximiuz/cdebug/releases/download/${VERSION}/checksums.txt"
grep "cdebug_linux_${ARCH}.tar.gz" checksums.txt | sha256sum -c -
tar -xzf "cdebug_linux_${ARCH}.tar.gz" cdebug
sudo install -m 0755 cdebug /usr/local/bin/cdebug
cdebug --version
PRACTICE CONTAINER (optional, folder ~/docker_volumes/cdebug): a tiny Node.js web server on port 8080 with no ports: line, so it is invisible from the host.
mkdir -p ~/docker_volumes/cdebug/{app,backups}
app/server.js: a Node http server that answers "hello from a container with no shell" on port 8080 and logs "listening on 8080".
compose.yaml (no version: line):
services:
demo:
image: gcr.io/distroless/nodejs24-debian13@sha256:00828b4b52a98d4846f5b32f2bc855613e6f6f258f3040120503519ad28d654c
container_name: cdebug-demo
command: ["/app/server.js"]
restart: unless-stopped
volumes:
- ./app:/app:ro
Start it: docker compose up -d then docker compose ps
Show me the problem first: docker exec -it cdebug-demo sh must fail ("executable file not found").
USING IT:
- Shell: cdebug exec -it --rm cdebug-demo (always add --rm; without it a stopped cdebug-<id> helper container is left behind). Inside, I can try ls -la /app, ps, cat /etc/os-release, wget -qO- http://127.0.0.1:8080 and exit.
- One command: cdebug exec --rm cdebug-demo cat /etc/os-release
- More tools: cdebug exec -it --rm --image nixery.dev/shell/vim cdebug-demo (on ARM use nixery.dev/arm64/shell/vim). Stay with the default busybox:musl or a nixery.dev image.
- Port: cdebug port-forward cdebug-demo -L 8080:8080 in one terminal, then curl http://127.0.0.1:8080 in another (curl.exe in PowerShell). Stop with Ctrl+C. Only -L exists; -R is not implemented.
- For my own container, replace cdebug-demo with its name. Kubernetes, containerd and Podman: only if I ask, and say these were not tested by the guide.
CHECK IT WORKED:
- cdebug --version prints a line like "cdebug version 0.0.19 (built: <date> commit: <hash>)", and on Linux the checksum command prints "cdebug_linux_<arch>.tar.gz: OK".
- docker compose ps shows cdebug-demo running with no published port.
- cdebug exec -it --rm cdebug-demo gives a busybox prompt; ls -la /app lists the target's files.
- After exit, docker ps -a --filter name=cdebug- lists only cdebug-demo.
- The port-forward answers "hello from a container with no shell" while it runs and fails after Ctrl+C.
Clean up when done: cd ~/docker_volumes/cdebug && docker compose down
RULES FOR YOU:
- Use only the version and settings above. Do not use releases/latest and do not invent options. cdebug is pre-alpha (0.0.x) and rarely updated: do not promise fixes. If a step fails, show me the exact error and read https://github.com/iximiuz/cdebug/blob/v0.0.19/README.md before guessing.
- The helper runs as root in the target's namespaces and leaves a .cdebug-<id> link in the target's root. Only debug containers I own and have allowed; mount app files read-only where possible.
- A forwarded port is bound to 127.0.0.1 only. Never ask me to expose it to the network.
- Names like cdebug-demo and <your-user> are examples; ask me for my container's name.
- Never ask me to paste passwords, tokens or keys into this chat.
Step 1: Install cdebug v0.0.19#
Linux#
We download the pinned release and check its SHA-256 sum before installing.
VERSION=v0.0.19
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
cd "$(mktemp -d)"
curl -fsSLO "https://github.com/iximiuz/cdebug/releases/download/${VERSION}/cdebug_linux_${ARCH}.tar.gz"
curl -fsSLO "https://github.com/iximiuz/cdebug/releases/download/${VERSION}/checksums.txt"
grep "cdebug_linux_${ARCH}.tar.gz" checksums.txt | sha256sum -c -
tar -xzf "cdebug_linux_${ARCH}.tar.gz" cdebug
sudo install -m 0755 cdebug /usr/local/bin/cdebug
cdebug --version
If docker ps needs sudo on your machine, cdebug needs it too. The release has linux and darwin files for amd64 and arm64. The README's install line uses releases/latest; we pin the version in the URL.
Windows (PowerShell)#
cdebug has no Windows file and the README does not list Windows. We run it inside WSL 2 next to Docker Desktop. That is our reading, not something the project documents. Check WSL 2 first:
wsl -l -v
The VERSION column should say 2. In Docker Desktop turn on Settings > Resources > WSL Integration for that distribution (Docker docs). Open the WSL terminal with wsl, run the Linux commands above there, and check that Docker answers:
docker ps
Mac (Terminal)#
brew install cdebug cdebug --version
The Homebrew formula was at 0.0.19 on 5 December 2026. Without Homebrew use the Linux commands with darwin for linux, ARCH=arm64 on Apple Silicon and shasum -a 256 -c -.
Docker Desktop on a Mac may not create /var/run/docker.sock, where cdebug looks unless DOCKER_HOST is set. Turn on Allow the default Docker socket to be used in Docker Desktop's advanced settings, or point cdebug at the user socket the Docker docs name:
export DOCKER_HOST="unix://$HOME/.docker/run/docker.sock"
Check it worked. cdebug --version prints a line like cdebug version 0.0.19 (built: <date> commit: <hash>) (the shape seen in issue 23). On Linux the checksum command prints cdebug_linux_<arch>.tar.gz: OK.
Tip: cdebug reads the Docker address from
DOCKER_HOST, not fromdocker context(the source builds its client from the environment). Ifdockerworks but cdebug cannot connect, that is why.
Step 2: Start a practice container with no shell#
We run a distroless Node.js 24 image with a tiny web server on port 8080 and no ports: line, so it is invisible from the host. The image is pinned by digest (the Debian 13 build as of 5 December 2026; the registry returned HTTP 200 for it). Its config runs as root (user 0) with entrypoint /nodejs/bin/node; the nonroot variants run as user 65532 (registry config).
Linux#
mkdir -p ~/docker_volumes/cdebug/{app,backups}
cd ~/docker_volumes/cdebug
cat > app/server.js << 'EOF'
const http = require('http');
http.createServer((req, res) => {
res.end('hello from a container with no shell\n');
}).listen(8080);
console.log('listening on 8080');
EOF
cat > compose.yaml << 'EOF'
services:
demo:
image: gcr.io/distroless/nodejs24-debian13@sha256:00828b4b52a98d4846f5b32f2bc855613e6f6f258f3040120503519ad28d654c
container_name: cdebug-demo
command: ["/app/server.js"]
restart: unless-stopped
volumes:
- ./app:/app:ro
EOF
docker compose up -d
docker compose ps
docker compose logs --tail=20 demo
Windows (PowerShell)#
$base = "$HOME\docker_volumes\cdebug"
foreach ($d in "app","backups") { New-Item -ItemType Directory -Force "$base\$d" | Out-Null }
Set-Location $base
@'
const http = require('http');
http.createServer((req, res) => {
res.end('hello from a container with no shell\n');
}).listen(8080);
console.log('listening on 8080');
'@ | Set-Content -Encoding ascii app\server.js
@'
services:
demo:
image: gcr.io/distroless/nodejs24-debian13@sha256:00828b4b52a98d4846f5b32f2bc855613e6f6f258f3040120503519ad28d654c
container_name: cdebug-demo
command: ["/app/server.js"]
restart: unless-stopped
volumes:
- ./app:/app:ro
'@ | Set-Content -Encoding ascii compose.yaml
docker compose up -d
docker compose ps
docker compose logs --tail=20 demo
Mac (Terminal)#
Same commands as Linux.
Check it worked. docker compose ps shows cdebug-demo running with no published port. Expected log line (from our own console.log): listening on 8080. Our Docker Compose guide explains the file format if it is new to you.
Step 3: See the problem#
Try the usual way in. This is the failure cdebug exists for.
Linux#
docker exec -it cdebug-demo sh
Windows (PowerShell)#
docker exec -it cdebug-demo sh
Mac (Terminal)#
Same commands as Linux.
Expected (the wording depends on your Docker version): OCI runtime exec failed: exec failed: unable to start container process: exec: "sh": executable file not found in $PATH. An older Docker printed exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown (distroless issue 891, 2021). The image has no shell to run.
Check it worked. You see an error and no prompt. Good. That is the baseline.
Step 4: Open a shell with cdebug exec#
Linux#
cdebug exec -it --rm cdebug-demo
Windows (PowerShell)#
Open the WSL terminal (wsl) and run the same command there:
cdebug exec -it --rm cdebug-demo
Mac (Terminal)#
Same commands as Linux.
The first run prints Pulling debugger image... while Docker fetches busybox:musl. Then you get a busybox prompt (/ #) inside the target's world. Try:
ls -la /app cat /app/server.js ps cat /etc/os-release wget -qO- http://127.0.0.1:8080 exit
What each command tells you:
| Command | What it shows |
|---|---|
ls -la /app | The target's files, as it sees them |
cat /etc/os-release | The target's OS release, not busybox's |
ps | The target's process list. PID 1 is the Node.js process, next to your own sh and ps |
wget -qO- http://127.0.0.1:8080 | The target's own localhost (shared network): test the app from inside |
The official README shows this for an older distroless Node image (not ours). Note the helper's link and the target's process on PID 1:
lrwxrwxrwx 1 root root 18 Oct 17 23:49 .cdebug-c153d669 -> /proc/55/root/bin/
...
PID USER TIME COMMAND
1 root 0:00 /nodejs/bin/node -e setTimeout(() => console.log("Done"),
21 root 0:00 sh
45 root 0:00 ps auxf
Check it worked. After exit, no helper is left behind because of --rm:
docker ps -a --filter name=cdebug-
Only cdebug-demo is listed. Without --rm, cdebug does not remove its helper container: the source default is AutoRemove: false.
Tip: Always add
--rm. Every run without it leaves a stoppedcdebug-<id>container behind.
Two side effects. The helper writes a link named .cdebug-<id> into the target's root, and we saw no code that removes it. And as root you can change the target's writable files. Our demo mounts /app read-only.
Step 5: Run one command, or bring more tools#
For scripts and quick looks you do not need -it. Put the command after the target:
Linux#
cdebug exec --rm cdebug-demo cat /etc/os-release cdebug exec --rm cdebug-demo ls -la /app
Windows (PowerShell)#
In the WSL terminal:
cdebug exec --rm cdebug-demo cat /etc/os-release cdebug exec --rm cdebug-demo ls -la /app
Mac (Terminal)#
Same commands as Linux.
If busybox is not enough, --image swaps the helper. The README uses Nixery, a public registry that builds an image on demand from the tool names in the image name:
cdebug exec -it --rm --image nixery.dev/shell/vim cdebug-demo
On an ARM machine (Apple Silicon, 64-bit Raspberry Pi) put arm64 first: nixery.dev/arm64/shell/vim (the Nixery front page). Without it, people got exec /bin/sh: exec format error (issue 7, 2023). We ran neither.
Check it worked. The commands print the target's OS release and the /app listing and return to your prompt. Nixery is slower the first time while it builds the image.
Tip: The helper's tools must work inside the target's root, so
busybox:muslis statically built. In issue 8 the olderbusybox:latestdefault was not static and failed withchroot: can't execute 'sh'on a scratch image. Stay withbusybox:muslor anixery.dev/...image. We did not test a distro image such asalpine(a README example) on a shell-less target.
Step 6: Forward a port the container does not publish#
Our demo listens on 8080 but publishes nothing. cdebug port-forward starts a forwarder container (socat) on the target's Docker network and publishes its port on your loopback address. In Terminal 1:
Linux#
cdebug port-forward cdebug-demo -L 8080:8080
Windows (PowerShell)#
In the WSL terminal:
cdebug port-forward cdebug-demo -L 8080:8080
Mac (Terminal)#
Same commands as Linux.
-L 8080:8080 means -L <port on your machine>:<port in the container>. With -L 8080 alone Docker picks a free local port and cdebug prints it. From the source, the output has this shape (the first run starts with Pulling forwarder image...):
Using existing forwarder image... Forwarding 127.0.0.1:8080 to <container-ip>:8080
Now in Terminal 2 (Linux and Mac):
curl http://127.0.0.1:8080 docker port cdebug-demo
On Windows use PowerShell and curl.exe, because plain curl there is an alias of another command:
curl.exe http://127.0.0.1:8080 docker port cdebug-demo
We did not test this on Windows; the README says forwarding works with Docker Desktop.
Expected: hello from a container with no shell, and no output from docker port (the demo still publishes nothing; the forwarder owns the port). Stop with Ctrl+C in Terminal 1: the source prints Forwarding's done. Exiting... and force-removes the forwarder.
Two more README forms, not run by us:
# a service that listens only on the container's own localhost cdebug port-forward <target> -L 127.0.0.1:5432 # a fixed local port to a host or network name the target can reach cdebug port-forward <target> -L <local-port>:<remote-host>:<remote-port>
Check it worked. curl prints the greeting while Terminal 1 runs and fails after Ctrl+C. The port is bound to 127.0.0.1, so other machines cannot reach it.
Tip: Only local forwarding (
-L) exists.-Rstops at once withremote port forwarding is not implemented yet(source code, and the README matrix shows it as work in progress).
Step 7: Clean up#
Linux#
cd ~/docker_volumes/cdebug docker compose down docker ps -a --filter name=cdebug-
Windows (PowerShell)#
Set-Location "$HOME\docker_volumes\cdebug" docker compose down docker ps -a --filter name=cdebug-
Mac (Terminal)#
Same commands as Linux.
Check it worked. The last command lists nothing. If it lists old cdebug-<id> helpers from runs without --rm, remove each with docker rm -f <name>.
What cdebug can reach#
The README matrix: exec works on Docker, containerd (and nerdctl) and Kubernetes. Local port-forward works on Docker only; remote forwarding is in progress; Podman, OCI and CRI answer "coming soon" in the code.
containerd and nerdctl use containerd://<name> or nerdctl://<name> with sudo (README). Kubernetes uses cdebug exec -it pod/<pod>/<container> and starts an ephemeral container (stable since v1.25; needs permission on pods/ephemeralcontainers, Kubernetes docs). Name the container too: with only pod/<pod>, issue 43 shows only the helper in ps. New to Kubernetes? See our introduction. Podman users: cdebug does not support it yet (our Podman guide). Colima users: see issue 47 and our Colima guide. We tested none of these.
cdebug or something else?#
| Tool | What it does | Watch out |
|---|---|---|
cdebug exec | Helper joins the target's network and PIDs, chroots into its files | Pre-alpha. Writes a link into the target. Running containers only |
docker debug | Docker's own toolbox (vim, nano, htop, curl, Nix packages), also for images and stopped containers | Docker's docs list it for Docker Desktop 4.49 or later; 4.48 and earlier needed a Pro, Team or Business plan |
kubectl debug | Ephemeral container, pod copy or node pod | Needs RBAC on pods/ephemeralcontainers |
| netshoot | A toolbox image you start next to the app | --network container: shares only the network. See our netshoot guide |
:debug image tag | A busybox shell inside a second image | A shell in the image is what you wanted to remove |
On Docker Desktop, docker debug is in our view the lower-risk first choice; cdebug fits plain Docker Engine on a server or a Pi. The README also lists slim debug (our slim guide).
Put it behind HTTPS with Traefik? You do not need to#
cdebug has no web page, and port-forward is meant for you alone on 127.0.0.1. Do not publish a debug port through a proxy. If debugging shows the app is fine and you want a permanent address, publish the app properly: see our Traefik guide or Caddy guide.
With Traefik#
No labels are needed. A proxy that shows 502 is a good reason to use port-forward: bypass the proxy, call the app directly, compare.
Without Traefik: Caddy#
No reverse_proxy line is needed for cdebug itself. To check what Caddy will reach, forward the app's port and compare it with your Caddyfile address.
Security and testing#
| Control | How |
|---|---|
| Docker access | cdebug uses the Docker socket: root-level power over the host. See our socket proxy guide |
| What the helper gets | It joins the target's network and PID namespaces and copies its privileged flag and capabilities (source). --privileged adds everything: use it only after the plain command fails |
| Shared namespaces | The README says network, PID and UTS. The source at v0.0.19 has the UTS line commented out ("stopped working in Docker 1.23") |
| Secrets | A session can read the target's environment. Do not paste a terminal into a ticket |
| Helper images | busybox:musl is a moving tag and nixery.dev builds images on demand. For sensitive work use --image busybox@sha256:<digest> or mirror it in your own registry |
| Forwarder image | port-forward pulls nixery.dev/shell/socat:latest, a name fixed in the code. The registry shows it is amd64 only, so ARM needs emulation (not tested) |
| Forward address | Loopback by default. A host first in -L (such as 0.0.0.0:8080:8080) exposes the port to your network. Do not |
| Your own images | Scan them first: Trivy or Grype |
Quick tests: cdebug --version, docker ps, and cdebug exec --rm cdebug-demo cat /etc/os-release.
Common mistakes#
| Mistake | Why it happens | Do this instead |
|---|---|---|
ln: /proc/1/root/.cdebug-4de48802: Permission denied (issue 37) | The helper gets the target's privileges; a non-root target gives it too few. sudo does not help | cdebug exec --privileged -it --rm <target> (the maintainer's answer; same on Kubernetes in issue 62) |
ln: failed to create symbolic link '/proc/1/root/.cdebug-9ddcdef9': Read-only file system (issue 68, open) | The error says the target's root is read-only, and cdebug writes a link there. Pull request 74 would drop it but is unmerged | No released fix. Use a toolbox container that shares the network (netshoot), or docker debug |
cdebug: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. (issue 47, open) | docker uses a context (Colima, Docker Desktop on a Mac); cdebug uses DOCKER_HOST or the default path | DOCKER_HOST=unix://<socket>, or --runtime unix://<socket> (the maintainer's tip). On a Mac turn on "Allow the default Docker socket to be used" |
chroot: can't execute 'sh': No such file or directory (issue 8, issue 7) | The helper's sh is for another CPU type, or not statically linked | Keep the default busybox:musl, or add --platform linux/amd64 (or linux/arm64) to match the target |
exec /bin/sh: exec format error with a Nixery image (issue 7) | nixery.dev/shell was amd64 only in 2023; the target was arm64 | --image nixery.dev/arm64/shell/<tools> on ARM |
cdebug: Cannot start debugger container: Error response from daemon: unable to find user node: no matching entries in passwd file. (issue 80, open) | --user node is looked up in the helper's image, not the target (our reading of the source). A non-root --user also skips the chroot | Use numbers such as --user 1000:1000. Not tested |
The shell exits at once, or the -t/--tty flag requires the -i/--stdin flag (source) | -i is missing | Always write -it |
Connection refused through port-forward to a service that listens only on 127.0.0.1 | The forwarder connects to the container's address, not its loopback (source and README, not run) | -L 127.0.0.1:<port> (README form) |
AI assistants: cdebug port-forward ... -R ..., or forwarding to a Kubernetes service | The README lists remote and Kubernetes forwarding as work in progress | -L on Docker only. The code stops -R with remote port forwarding is not implemented yet |
AI assistants: winget install cdebug, a Windows .exe, or running it from PowerShell | Assumes every Go tool has a Windows build | None in v0.0.19. Use WSL 2. We found no winget package called cdebug (GitHub search, 5 December 2026) |
AI assistants: --image nixery/shell, or docker debug called "paid" or "free" with no source | Invented names, old and new news mixed | nixery.dev/shell/<tools> or the default. Docker's docs: Docker Desktop 4.49 and later; 4.48 and earlier needed a paid plan |
Tip: On a
Permission denied, the README FAQ and the code's own hint (Hint: try running cdebug exec with the --privileged flag, shown for some errors) point to--privileged. Try the plain command first, then add it, and note that you needed it.
Tip: Name the container exactly as in
docker ps. Do not guess an ID from an old terminal.
Tip: When a message is thin, put
-l debugbefore the command:cdebug -l debug exec ...(source).
Troubleshooting#
| Problem | Solution |
|---|---|
cdebug: command not found | The file is not in your PATH. On Windows install it inside WSL 2 |
| Wrong version | cdebug --version, then reinstall with VERSION=v0.0.19 (Step 1) |
| Cannot reach Docker | docker ps first. Then echo $DOCKER_HOST, the Mac socket setting or WSL integration |
| First run is slow | Docker pulls busybox:musl, or Nixery builds the image. Wait and retry |
Leftover cdebug-<id> containers | docker ps -a --filter name=cdebug-, then docker rm -f <name>. Add --rm next time |
| Port already in use | Pick another local port, or leave it out: -L 8080 |
| Need more detail | cdebug -l debug exec -it --rm <target>, docker logs <target> --tail 100, docker inspect <target> |
Exact error texts#
chroot: can't execute '/bin/sh': No such file or directory(issue 23): a v0.0.16 regression, fixed in v0.0.17; writingshexplicitly was the workaround.rm: cannot remove '/proc/1/root/nix': Permission denied(issue 62): a Nixery image on a non-root target.--privilegedfixed it.
Known bugs (open, December 2026)#
Open: issue 7 (scratch and pause images; the maintainer hoped v0.0.17 fixed it, no confirmation), 68 (read-only root), 47 (Docker address), 80 (--user), 43 and 70 (CoreDNS pods). Issue 78 asked for Linux ARM; v0.0.19 has a linux_arm64 file, but the issue is still open. Nothing here stops a normal Docker install.
Updates and backups#
Update cdebug. Read the releases, change VERSION in Step 1 and run it again, or on a Mac brew upgrade cdebug. The last release is from January 2026.
What to back up. cdebug keeps no data or settings; only our throwaway demo files exist. For real volumes see our docker-volume-backup guide.
Linux and Mac#
Save as ~/docker_volumes/cdebug/backup.sh:
#!/usr/bin/env bash set -euo pipefail base="$HOME/docker_volumes/cdebug" out="$base/backups/cdebug-$(date +%F).tar.gz" tar -czf "$out" -C "$base" compose.yaml app chmod 600 "$out"
Run chmod 700 on it and add this line with crontab -e (on a Mac write /Users/<your-user>/...):
0 3 * * * /home/<your-user>/docker_volumes/cdebug/backup.sh
Windows (PowerShell)#
Save as $HOME\docker_volumes\cdebug\backup.ps1:
$base = "$HOME\docker_volumes\cdebug" $out = "$base\backups\cdebug-$(Get-Date -Format yyyy-MM-dd).tar.gz" tar.exe -czf $out -C $base compose.yaml app
In Task Scheduler run powershell.exe -NoProfile -File <full-path-to-the-script> daily at 03:00.
Restore test#
mkdir restore-test && tar -xzf cdebug-<date>.tar.gz -C restore-test cd restore-test && docker compose config -q
No output means the Compose file is valid.
Performance and resources#
The docs give no minimum RAM or CPU and we measured none. The program is about 15 MiB and the default helper under 1 MiB compressed. The cost is time on the first run: busybox:musl and, for port-forward, the socat image are pulled once and cached. A Nixery tool image is built on demand and can be larger. Watch a session with docker stats. The helper exits when you leave the shell.
FAQ#
Does cdebug change my container? It does not restart or rebuild it. It does write a .cdebug-<id> link into its root, and as root you can change the target's writable files. Treat a session as live surgery.
Is docker debug better? On Docker Desktop it is more polished and also covers stopped containers and images. cdebug is free software for plain Docker Engine, containerd and Kubernetes.
Is it safe in production? It is pre-alpha with root-level reach and a slow maintainer. Try it on a bench first and have a plan that does not depend on it.
Sources#
- cdebug: repository, README at v0.0.19, release v0.0.19 (18 January 2026) with its checksums, LICENSE (Apache-2.0); source at the tag: exec.go, exec_docker.go, portforward.go, main.go, .goreleaser.yaml, go.mod (read December 2026)
- Issues: 7, 8, 23, 37, 43, 47, 62, 68, 78, 80, 81; 70 and pull request 74 (only opened or title read)
- Homebrew: formulae.brew.sh/formula/cdebug (0.0.19, December 2026)
- Docker: docker debug reference and the "requires Docker Desktop 4.49 and later" line in the docs' summary.yaml; Mac permission requirements; WSL 2 backend and use WSL (December 2026)
- Kubernetes ephemeral containers (stable since v1.25, December 2026)
- Images: Nixery and its repository (Apache-2.0); busybox on Docker Hub; distroless Node.js and the
gcr.io/distroless/nodejs24-debian13manifest (5 December 2026); distroless issue 891
Checked against the official docs on 2026-12-05. Nothing was run on a real machine by DIY Lab Hub; the commands come from the README, the source at v0.0.19, the Docker and Kubernetes docs and the issues above, and the image facts from the public registry APIs.