Docker和.bash_history [英] Docker and .bash_history
问题描述
有没有办法与docker容器共享一个 .bash_history
卷,这样每当我进入一个shell我有我的bash历史可以滚动? p>
可以使用IPython也能做同样的事情。
这是来自有关卷的文档:将主机文件作为数据卷安装 :
docker运行--rm -it -v〜/ .bash_history:/root/.bash_history ubuntu / bin / bash
这将使您进入新的容器中的bash shell,您将从主机拥有您的 bash历史记录,当您退出该容器时,主机将在容器中输入命令的历史。
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 through?
Would be awesome to be able to do the same thing with IPython too.
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.
这篇关于Docker和.bash_history的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!