Bind a directory to a docker container -


i'm building test project requires module outside of project directory. project folder in docker, , bind module directory docker container of project. possible it? or asking wrong question? way, i'm still new docker i'm trying things out.

my understand is, need mount host folder container. try this:

docker run -v /host/project_folder:/container/project -t avian/project_image bash 

explanation

  • -v - --volume=[] bind mount volume
  • /host/project_folder - host server's folder
  • /container/project - container's folder

update:

the latest docker version (v1.9.1) support new command volume. should easier manage volume in docker.

# example, need attach volume mysql container. docker volume create --name mysql-data docker run --name mysql -v mysql-data:/var/lib/mysql -e mysql_root_password=my-secret-pw -d mysql 

with that, can delete container mysql time, without lost database data.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -