It is persistent for the life of the container. If you remove the container (i.e., docker rm
) you would have to start a new one with the same mount. But you can docker stop
and docker start
the container and the mount will still persist.
One thing you could do is use an alias. I have an alias that runs any docker image and mounts the current folder under a mount point called /app
.
This is the alias:
alias dr='docker run --rm -it -h dev -v $(pwd):/app -w /app'
With this you can say:
dr ubuntu bash
and it will run a bash
shell in a container from the ubuntu
image and mount the current working directory under /app
inside the container so that you can manipulate the files from inside or outside the container. So you could do something similar by creating an alias that adds your mount point to the docker
command.
~jr