How to set up a data volume within docker?

心不动则不痛 提交于 2019-12-25 08:03:12

问题


I am trying to set up rocker/rstudio docker on a linux ubuntu 14.04.5 with a data volume so all my data is outside of the docker. I have looked at Manage data in containers for some some guidance.

sudo docker run -d -p 8787:8787 rocker/rstudio  -v ~/data/

I get back the following error:

docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\"-v\\": executable file not found in $PATH\"\n".


回答1:


  1. Your -v flag should appear before the name of the image your want to run. If you list it after the image name docker will interpret it as the command used to launch the container.
  2. You shouldn't use ~ when referring to the container volume. A better approach would be to use an absolute path like /data
  3. If you are using a data volume in order to get persistence, consider mounting a host directory as your data volume (as seen in the tutorial you've linked to under Mount a host directory as a data volume.

Your final command should look something like this -

sudo docker run -d -p 8787:8787 -v /src/data:/data/ rocker/rstudio



来源:https://stackoverflow.com/questions/41382793/how-to-set-up-a-data-volume-within-docker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!