From c182ada0dd7c45765f008e30c10452a328454435 Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Thu, 23 Apr 2026 09:17:39 +0200 Subject: [PATCH] Persist zoxide directory history across container recreations Zoxide stores its database at ~/.local/share/zoxide/db.zo. Without a named volume, the 'z ' jump targets are lost on every 'docker compose up --force-recreate'. Add devbox-zoxide named volume in docker-compose.yml and docker-compose.shared.yml, add ~/.local/share/zoxide to the entrypoint ownership-fix loop per AGENTS.md convention, and update the data-persistence tables in README.md and DOCKER_HUB.md. --- DOCKER_HUB.md | 1 + README.md | 1 + docker-compose.shared.yml | 4 ++++ docker-compose.yml | 4 ++++ entrypoint.sh | 1 + 5 files changed, 11 insertions(+) diff --git a/DOCKER_HUB.md b/DOCKER_HUB.md index 3aca9c7..23baf67 100644 --- a/DOCKER_HUB.md +++ b/DOCKER_HUB.md @@ -228,6 +228,7 @@ Understanding what survives container restarts and what doesn't: | `/home/developer/.local/share/opencode` | Named volume (if configured) | ✅ Yes — Docker volume | Session history, memory, auth tokens | | `/home/developer/.local/state/opencode` | Named volume (if configured) | ✅ Yes — Docker volume | TUI settings (theme, toggles) | | `/home/developer/.cache/bash` | Named volume `devbox-shell-history` | ✅ Yes — Docker volume | Bash history (`$HISTFILE`) — survives container recreate | +| `/home/developer/.local/share/zoxide` | Named volume `devbox-zoxide` | ✅ Yes — Docker volume | Zoxide directory history (`z ` jump targets) | | `/home/developer/.local/share/uv` | Named volume (if configured) | ✅ Yes — Docker volume | Python installs, uv tool installs | | `/home/developer/.rustup` | Named volume (if configured) | ✅ Yes — Docker volume | Rust toolchains | | `/home/developer/.cargo` | Named volume (if configured) | ✅ Yes — Docker volume | Cargo binaries, registry cache | diff --git a/README.md b/README.md index 3d00090..36beca9 100644 --- a/README.md +++ b/README.md @@ -548,6 +548,7 @@ Container (Debian trixie) | `/home/developer/.local/share/opencode` | Named volume `devbox-data` | ✅ Yes | Session history, memory | | `/home/developer/.local/state/opencode` | Named volume `devbox-state` | ✅ Yes | TUI settings (theme, toggles) | | `/home/developer/.cache/bash` | Named volume `devbox-shell-history` | ✅ Yes | Bash history (`$HISTFILE`), survives container recreate | +| `/home/developer/.local/share/zoxide` | Named volume `devbox-zoxide` | ✅ Yes | Zoxide directory history (`z ` jump targets) | | `/home/developer/.local/share/uv` | Named volume `devbox-uv` (if configured) | ✅ Yes | Python installs, uv tool installs | | `/home/developer/.rustup` | Named volume `devbox-rustup` (if configured) | ✅ Yes | Rust toolchains | | `/home/developer/.cargo` | Named volume `devbox-cargo` (if configured) | ✅ Yes | Cargo binaries, registry cache | diff --git a/docker-compose.shared.yml b/docker-compose.shared.yml index 80d451b..8701e8e 100644 --- a/docker-compose.shared.yml +++ b/docker-compose.shared.yml @@ -52,6 +52,9 @@ services: # Persist bash history across container recreations - devbox-shell-history:/home/developer/.cache/bash + # Persist zoxide directory history ('z ' to jump) + - devbox-zoxide:/home/developer/.local/share/zoxide + # Persist uv data (Python installs) - devbox-uv:/home/developer/.local/share/uv @@ -61,4 +64,5 @@ services: volumes: devbox-data: devbox-shell-history: + devbox-zoxide: devbox-uv: diff --git a/docker-compose.yml b/docker-compose.yml index 2bbff22..8d82bee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,6 +61,9 @@ services: # Without this, ~/.bash_history is lost on 'docker compose up --force-recreate'. - devbox-shell-history:/home/developer/.cache/bash + # Persist zoxide directory history ('z ' to jump). + - devbox-zoxide:/home/developer/.local/share/zoxide + # Optional: override baked shell defaults with your host's rc files. # The image ships sensible defaults (history tuning, prefix-search on # Up/Down arrows, fzf/zoxide integration). Uncomment to use your own: @@ -93,6 +96,7 @@ volumes: devbox-data: devbox-state: devbox-shell-history: + devbox-zoxide: devbox-uv: # devbox-rustup: # devbox-cargo: diff --git a/entrypoint.sh b/entrypoint.sh index dc85123..15a9a49 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -77,6 +77,7 @@ for dir in \ /home/"$USER_NAME"/.local/share/opencode \ /home/"$USER_NAME"/.local/state/opencode \ /home/"$USER_NAME"/.local/share/uv \ + /home/"$USER_NAME"/.local/share/zoxide \ /home/"$USER_NAME"/.cache/bash \ /home/"$USER_NAME"/.rustup \ /home/"$USER_NAME"/.cargo \