Skip to content

Project showing how to setup persistent shell history in a docker container

Notifications You must be signed in to change notification settings

curusarn/persistent-docker-history

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

persistent-docker-history

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.

Try it!

  1. Clone this repo git clone git@github.com:curusarn/persistent-docker-history.git
  2. Run make docker
  3. Use arrow up to get previous commands or whatever

Configure persistent history for your existing docker-compose

  1. Add .docker_bash_history:/root/.bash_history to volumes in your docker-compose.yaml
  2. Run touch .docker_bash_history (OR something like echo 'echo "it works!"' > .docker_bash_history)
  3. Use docker-compose run ... as usual

Prerequisities

  • docker
  • docker-compose
  • standard stuff (make, other things I can't think of right now)

About

Project showing how to setup persistent shell history in a docker container

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published