Is there any way to share a .bash_history volume with a docker container so that everytime I go into a shell I have my bash history available for scrolling thro
My solution is useful when:
.bash_history with .bash_history in your container.bash_history between your builds.bash_history to git repo but you want to create it automatically inside same directory when a container startsI assume file structure to be:
docker-compose.yml
docker/
\--> bash/
\--> .bashrc
\--> .bash_history
docker-compose.yml
web-service:
build: .
volumes:
- ./docker/bash/.bashrc:/home/YOUR_USER_NAME/.bashrc
- ./docker/bash:/home/YOUR_USER_NAME/bash
./docker/bash/.bashrc - it will automatically create .bash_history:
export HISTFILE=~/bash/.bash_history
touch $HISTFILE
Optionally, you can add to .gitignore:
docker/bash/.bash_history