Project showing how to setup persistent shell history in a docker container
- I often use commandline inside docker containers.
- I don't like to type same commands over and over again.
- So I use docker-compose volume to keep the history in the project directory instead of docker container.
- I usually populate the history with useful commands and commit them to git so anyone who clones the project can use them.
- And then I just leave the file alone and use it as personal docker history for the project.
- Clone this repo
git clone git@github.com:curusarn/persistent-docker-history.git
- Run
make docker
- Use arrow up to get previous commands or whatever
- Add
.docker_bash_history:/root/.bash_history
tovolumes
in yourdocker-compose.yaml
- Run
touch .docker_bash_history
(OR something likeecho 'echo "it works!"' > .docker_bash_history
) - Use
docker-compose run ...
as usual
docker
docker-compose
- standard stuff (
make
, other things I can't think of right now)