linux - Mount data volume to docker with read&write permission -


i want mount host data volume docker. container should have read , write permission it, meantime, any changes on data volumes should not affect data in host.

i can image solution mount several data volumes single folder, 1 read read , write. second '-v' works in command,

docker run -ti --name build_cent1 -v /codebase/:/code:ro -v /temp:/code:rw centos6:1.0 bash 

only second '-v' works in command,

that might because both -v options attempt mount host folders on same container destination folder /code.

   -v /codebase/:/code:ro                   ^^^^^    -v /temp:/code:rw             ^^^^^    

you mount host folders in 2 separate folders within /code.
in:

-v /codebase/:/code/base:ro -v /temp:/code/temp:rw. 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -