Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker and .bash_history

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.

like image 648
tzenderman Avatar asked Feb 02 '15 14:02

tzenderman


People also ask

Can I run Visual Studio in a Docker container?

The Visual Studio Code Dev Containers extension lets you use a Docker container as a full-featured development environment. It allows you to open any folder inside (or mounted into) a container and take advantage of Visual Studio Code's full feature set.

Can Docker use automation testing?

Docker Hub can automatically test changes to your source code repositories using containers. You can enable Autotest on any Docker Hub repository to run tests on each pull request to the source code repository to create a continuous integration testing service.

What is Docker and Dockerization?

Dockerizing is the process of packing, deploying, and running applications using Docker containers. Docker is an open source tool that ships your application with all the necessary functionalities as one package.

Can Docker run cross platform?

Docker is supposed to be a cross-platform tool. It runs on MacOS, Windows and Linux. You can use the containers everywhere, so it should be cross-platform.


1 Answers

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.

like image 183
user2915097 Avatar answered Oct 07 '22 18:10

user2915097