Devcontainer Gotchas

Installing a missing tool (and making it survive rebuilds)

# Quick check
which gawk || echo "not installed"
 
# Ad hoc install (won't survive a container rebuild)
sudo apt-get update && sudo apt-get install -y gawk

For anything that needs to persist, add it to the Dockerfile instead of installing ad hoc:

RUN apt-get update && apt-get install -y gawk && rm -rf /var/lib/apt/lists/*

~ and $HOME aren’t host-reachable

Quoted "~/terminal_logs" doesn’t tilde-expand in bash — expansion only happens unquoted. Separately, $HOME inside a devcontainer (e.g. /home/vscode) is often not bind-mounted back to the host at all — only explicitly listed mounts are. Anything written there vanishes on container rebuild.

Write to the live bind-mounted workspace root instead (commonly /workspace) so it’s actually reachable from the host and persists across rebuilds.