Docker and .bash_history

前端 未结 6 1824
感动是毒
感动是毒 2020-12-30 19:58

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

6条回答
  •  悲哀的现实
    2020-12-30 20:43

    It is the example from the documentation about volume: Mount a host file as a data volume:

    docker run --rm -it -v ~/.bash_history:/root/.bash_history ubuntu /bin/bash
    

    This will drop you into a bash shell in a new container, you will have your bash history from the host and when you exit the container, the host will have the history of the commands typed while in the container.

提交回复
热议问题