By default, shell hsitory is not persistent across VSCode remote container restarts. To persist, a local (in the container) .zsh_history
file must be makked to a file on the host computer. To do this you need to select a unique name to map the local file to. Here is how I do it in my .devcontainer
file (only relevant lines shown):
{
"name": "AWS Development (aws-dev)",
^^^^ this will be the unique name of the history file on the local machine
"mounts": [
"source=${env:HOME}${env:USERPROFILE}/.vscode-zsh-hists/aws-dev.zsh_history,target=/home/devboy/.zsh_history,type=bind"
^^^^ here's where the mapping occurs
]
}
Before building the container for the first time, the local directory and file must exist:
mkdir .vscode-zsh-hists
touch .vscode-zsh-hists/aws-dev.zsh_history