问题
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:
- 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.
- You shouldn't use
~
when referring to the container volume. A better approach would be to use an absolute path like/data
- 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